diff --git a/CMakeLists.txt b/CMakeLists.txt index 90f7a2340..e564452b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -246,6 +246,7 @@ if(NOT TRITON_CORE_HEADERS_ONLY) # Location where protobuf-config.cmake will be installed set(_FINDPACKAGE_PROTOBUF_CONFIG_DIR "${TRITON_THIRD_PARTY_INSTALL_PREFIX}/protobuf/${LIB_DIR}/cmake/protobuf") + set(_FINDPACKAGE_UTF8_RANGE_CONFIG_DIR "${TRITON_THIRD_PARTY_INSTALL_PREFIX}/protobuf/${LIB_DIR}/cmake/utf8_range") if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(TRITON_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/install) @@ -286,6 +287,7 @@ if(NOT TRITON_CORE_HEADERS_ONLY) BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/triton-core" CMAKE_CACHE_ARGS -DProtobuf_DIR:PATH=${_FINDPACKAGE_PROTOBUF_CONFIG_DIR} + -Dutf8_range_DIR:PATH=${_FINDPACKAGE_UTF8_RANGE_CONFIG_DIR} ${_CMAKE_ARGS_OPENSSL_ROOT_DIR} ${_CMAKE_ARGS_CMAKE_TOOLCHAIN_FILE} ${_CMAKE_ARGS_VCPKG_TARGET_TRIPLET} diff --git a/src/model_config_utils.cc b/src/model_config_utils.cc index 36d9dcd33..85632e966 100644 --- a/src/model_config_utils.cc +++ b/src/model_config_utils.cc @@ -26,6 +26,7 @@ #include "model_config_utils.h" +#include #include #include @@ -754,7 +755,21 @@ GetNormalizedModelConfig( RETURN_IF_ERROR( AutoCompleteBackendFields(model_name, std::string(path), config)); - LOG_PROTOBUF_VERBOSE(1, "Server side auto-completed config: ", (*config)); + // Not using LOG_PROTOBUF_VERBOSE: it serializes via protobuf DebugString(), + // which protobuf v33 deliberately makes unstable (injects a + // "goo.gle/debugstr" marker) to discourage parsing. That marker is not valid + // text format and pollutes the logged config. Serialize with + // TextFormat::PrintToString for stable, parseable output. + if (LOG_VERBOSE_IS_ON(1)) { + std::string auto_completed_config; + google::protobuf::TextFormat::PrintToString( + *config, &auto_completed_config); + triton::common::LogMessage( + __FILE__, __LINE__, triton::common::Logger::Level::kINFO, + "Server side auto-completed config: ", false) + .stream() + << auto_completed_config; + } RETURN_IF_ERROR(NormalizeModelConfig(min_compute_capability, config)); @@ -1976,7 +1991,7 @@ CollectInt64Fields( const google::protobuf::Reflection* refl = message->GetReflection(); for (int i = 0; i < desc->field_count(); ++i) { const google::protobuf::FieldDescriptor* field = desc->field(i); - const std::string fullname = prefix + "::" + field->name(); + const std::string fullname = prefix + "::" + std::string(field->name()); switch (field->type()) { case google::protobuf::FieldDescriptor::TYPE_MESSAGE: { if (field->is_repeated()) { @@ -2201,9 +2216,15 @@ ModelConfigToJson( std::string config_json_str; ::google::protobuf::util::JsonPrintOptions options; options.preserve_proto_field_names = true; - options.always_print_primitive_fields = true; - ::google::protobuf::util::MessageToJsonString( + options.always_print_fields_with_no_presence = true; + const auto to_json_status = ::google::protobuf::util::MessageToJsonString( config, &config_json_str, options); + if (!to_json_status.ok()) { + return Status( + Status::Code::INTERNAL, + "failed to convert model configuration to JSON: " + + std::string(to_json_status.message())); + } // We need to verify that every field 64-bit field in the // ModelConfig protobuf is being handled. We hardcode the known