From 5a8b66ab3dfc1b1d93647ef9865779fcfde6a70d Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 30 Aug 2024 12:50:34 +0800 Subject: [PATCH] Reduce onnxruntime log output. (#1306) Change the logging level from WARNING to ERROR. --- sherpa-onnx/csrc/offline-ctc-model.cc | 2 +- sherpa-onnx/csrc/offline-transducer-model.cc | 4 ++-- .../csrc/offline-transducer-nemo-model.cc | 4 ++-- sherpa-onnx/csrc/offline-tts-vits-model.cc | 4 ++-- .../csrc/online-conformer-transducer-model.cc | 4 ++-- sherpa-onnx/csrc/online-lstm-transducer-model.cc | 4 ++-- sherpa-onnx/csrc/online-nemo-ctc-model.cc | 2 +- sherpa-onnx/csrc/online-paraformer-model.cc | 2 +- sherpa-onnx/csrc/online-recognizer-impl.cc | 4 ++-- sherpa-onnx/csrc/online-transducer-model.cc | 2 +- sherpa-onnx/csrc/online-transducer-nemo-model.cc | 4 ++-- sherpa-onnx/csrc/online-wenet-ctc-model.cc | 2 +- .../csrc/online-zipformer-transducer-model.cc | 4 ++-- sherpa-onnx/csrc/online-zipformer2-ctc-model.cc | 2 +- .../csrc/online-zipformer2-transducer-model.cc | 16 ++++++++-------- .../csrc/speaker-embedding-extractor-impl.cc | 2 +- .../csrc/spoken-language-identification-impl.cc | 2 +- 17 files changed, 32 insertions(+), 32 deletions(-) diff --git a/sherpa-onnx/csrc/offline-ctc-model.cc b/sherpa-onnx/csrc/offline-ctc-model.cc index 6331a650ba..66e67ecf18 100644 --- a/sherpa-onnx/csrc/offline-ctc-model.cc +++ b/sherpa-onnx/csrc/offline-ctc-model.cc @@ -35,7 +35,7 @@ namespace sherpa_onnx { static ModelType GetModelType(char *model_data, size_t model_data_length, bool debug) { - Ort::Env env(ORT_LOGGING_LEVEL_WARNING); + Ort::Env env(ORT_LOGGING_LEVEL_ERROR); Ort::SessionOptions sess_opts; sess_opts.SetIntraOpNumThreads(1); sess_opts.SetInterOpNumThreads(1); diff --git a/sherpa-onnx/csrc/offline-transducer-model.cc b/sherpa-onnx/csrc/offline-transducer-model.cc index fe32388fa1..6a297347dd 100644 --- a/sherpa-onnx/csrc/offline-transducer-model.cc +++ b/sherpa-onnx/csrc/offline-transducer-model.cc @@ -19,7 +19,7 @@ class OfflineTransducerModel::Impl { public: explicit Impl(const OfflineModelConfig &config) : config_(config), - env_(ORT_LOGGING_LEVEL_WARNING), + env_(ORT_LOGGING_LEVEL_ERROR), sess_opts_(GetSessionOptions(config)), allocator_{} { { @@ -41,7 +41,7 @@ class OfflineTransducerModel::Impl { #if __ANDROID_API__ >= 9 Impl(AAssetManager *mgr, const OfflineModelConfig &config) : config_(config), - env_(ORT_LOGGING_LEVEL_WARNING), + env_(ORT_LOGGING_LEVEL_ERROR), sess_opts_(GetSessionOptions(config)), allocator_{} { { diff --git a/sherpa-onnx/csrc/offline-transducer-nemo-model.cc b/sherpa-onnx/csrc/offline-transducer-nemo-model.cc index eee744abc4..f18e57da9d 100644 --- a/sherpa-onnx/csrc/offline-transducer-nemo-model.cc +++ b/sherpa-onnx/csrc/offline-transducer-nemo-model.cc @@ -21,7 +21,7 @@ class OfflineTransducerNeMoModel::Impl { public: explicit Impl(const OfflineModelConfig &config) : config_(config), - env_(ORT_LOGGING_LEVEL_WARNING), + env_(ORT_LOGGING_LEVEL_ERROR), sess_opts_(GetSessionOptions(config)), allocator_{} { { @@ -43,7 +43,7 @@ class OfflineTransducerNeMoModel::Impl { #if __ANDROID_API__ >= 9 Impl(AAssetManager *mgr, const OfflineModelConfig &config) : config_(config), - env_(ORT_LOGGING_LEVEL_WARNING), + env_(ORT_LOGGING_LEVEL_ERROR), sess_opts_(GetSessionOptions(config)), allocator_{} { { diff --git a/sherpa-onnx/csrc/offline-tts-vits-model.cc b/sherpa-onnx/csrc/offline-tts-vits-model.cc index 3a2bdfdb45..c97cecf800 100644 --- a/sherpa-onnx/csrc/offline-tts-vits-model.cc +++ b/sherpa-onnx/csrc/offline-tts-vits-model.cc @@ -19,7 +19,7 @@ class OfflineTtsVitsModel::Impl { public: explicit Impl(const OfflineTtsModelConfig &config) : config_(config), - env_(ORT_LOGGING_LEVEL_WARNING), + env_(ORT_LOGGING_LEVEL_ERROR), sess_opts_(GetSessionOptions(config)), allocator_{} { auto buf = ReadFile(config.vits.model); @@ -29,7 +29,7 @@ class OfflineTtsVitsModel::Impl { #if __ANDROID_API__ >= 9 Impl(AAssetManager *mgr, const OfflineTtsModelConfig &config) : config_(config), - env_(ORT_LOGGING_LEVEL_WARNING), + env_(ORT_LOGGING_LEVEL_ERROR), sess_opts_(GetSessionOptions(config)), allocator_{} { auto buf = ReadFile(mgr, config.vits.model); diff --git a/sherpa-onnx/csrc/online-conformer-transducer-model.cc b/sherpa-onnx/csrc/online-conformer-transducer-model.cc index 8e7dfa1f44..7c252f5a44 100644 --- a/sherpa-onnx/csrc/online-conformer-transducer-model.cc +++ b/sherpa-onnx/csrc/online-conformer-transducer-model.cc @@ -30,7 +30,7 @@ namespace sherpa_onnx { OnlineConformerTransducerModel::OnlineConformerTransducerModel( const OnlineModelConfig &config) - : env_(ORT_LOGGING_LEVEL_WARNING), + : env_(ORT_LOGGING_LEVEL_ERROR), config_(config), sess_opts_(GetSessionOptions(config)), allocator_{} { @@ -53,7 +53,7 @@ OnlineConformerTransducerModel::OnlineConformerTransducerModel( #if __ANDROID_API__ >= 9 OnlineConformerTransducerModel::OnlineConformerTransducerModel( AAssetManager *mgr, const OnlineModelConfig &config) - : env_(ORT_LOGGING_LEVEL_WARNING), + : env_(ORT_LOGGING_LEVEL_ERROR), config_(config), sess_opts_(GetSessionOptions(config)), allocator_{} { diff --git a/sherpa-onnx/csrc/online-lstm-transducer-model.cc b/sherpa-onnx/csrc/online-lstm-transducer-model.cc index eca1159316..094cc933c5 100644 --- a/sherpa-onnx/csrc/online-lstm-transducer-model.cc +++ b/sherpa-onnx/csrc/online-lstm-transducer-model.cc @@ -28,7 +28,7 @@ namespace sherpa_onnx { OnlineLstmTransducerModel::OnlineLstmTransducerModel( const OnlineModelConfig &config) - : env_(ORT_LOGGING_LEVEL_WARNING), + : env_(ORT_LOGGING_LEVEL_ERROR), config_(config), sess_opts_(GetSessionOptions(config)), allocator_{} { @@ -51,7 +51,7 @@ OnlineLstmTransducerModel::OnlineLstmTransducerModel( #if __ANDROID_API__ >= 9 OnlineLstmTransducerModel::OnlineLstmTransducerModel( AAssetManager *mgr, const OnlineModelConfig &config) - : env_(ORT_LOGGING_LEVEL_WARNING), + : env_(ORT_LOGGING_LEVEL_ERROR), config_(config), sess_opts_(GetSessionOptions(config)), allocator_{} { diff --git a/sherpa-onnx/csrc/online-nemo-ctc-model.cc b/sherpa-onnx/csrc/online-nemo-ctc-model.cc index e4335b4b14..d93ff73b1f 100644 --- a/sherpa-onnx/csrc/online-nemo-ctc-model.cc +++ b/sherpa-onnx/csrc/online-nemo-ctc-model.cc @@ -39,7 +39,7 @@ class OnlineNeMoCtcModel::Impl { #if __ANDROID_API__ >= 9 Impl(AAssetManager *mgr, const OnlineModelConfig &config) : config_(config), - env_(ORT_LOGGING_LEVEL_WARNING), + env_(ORT_LOGGING_LEVEL_ERROR), sess_opts_(GetSessionOptions(config)), allocator_{} { { diff --git a/sherpa-onnx/csrc/online-paraformer-model.cc b/sherpa-onnx/csrc/online-paraformer-model.cc index 2d6a410e23..9397ff75bd 100644 --- a/sherpa-onnx/csrc/online-paraformer-model.cc +++ b/sherpa-onnx/csrc/online-paraformer-model.cc @@ -41,7 +41,7 @@ class OnlineParaformerModel::Impl { #if __ANDROID_API__ >= 9 Impl(AAssetManager *mgr, const OnlineModelConfig &config) : config_(config), - env_(ORT_LOGGING_LEVEL_WARNING), + env_(ORT_LOGGING_LEVEL_ERROR), sess_opts_(GetSessionOptions(config)), allocator_{} { { diff --git a/sherpa-onnx/csrc/online-recognizer-impl.cc b/sherpa-onnx/csrc/online-recognizer-impl.cc index 2784ad24cc..399dab49e4 100644 --- a/sherpa-onnx/csrc/online-recognizer-impl.cc +++ b/sherpa-onnx/csrc/online-recognizer-impl.cc @@ -28,7 +28,7 @@ namespace sherpa_onnx { std::unique_ptr OnlineRecognizerImpl::Create( const OnlineRecognizerConfig &config) { if (!config.model_config.transducer.encoder.empty()) { - Ort::Env env(ORT_LOGGING_LEVEL_WARNING); + Ort::Env env(ORT_LOGGING_LEVEL_ERROR); auto decoder_model = ReadFile(config.model_config.transducer.decoder); auto sess = std::make_unique( @@ -61,7 +61,7 @@ std::unique_ptr OnlineRecognizerImpl::Create( std::unique_ptr OnlineRecognizerImpl::Create( AAssetManager *mgr, const OnlineRecognizerConfig &config) { if (!config.model_config.transducer.encoder.empty()) { - Ort::Env env(ORT_LOGGING_LEVEL_WARNING); + Ort::Env env(ORT_LOGGING_LEVEL_ERROR); auto decoder_model = ReadFile(mgr, config.model_config.transducer.decoder); auto sess = std::make_unique( diff --git a/sherpa-onnx/csrc/online-transducer-model.cc b/sherpa-onnx/csrc/online-transducer-model.cc index a6cd49d9e9..16577dd491 100644 --- a/sherpa-onnx/csrc/online-transducer-model.cc +++ b/sherpa-onnx/csrc/online-transducer-model.cc @@ -37,7 +37,7 @@ namespace sherpa_onnx { static ModelType GetModelType(char *model_data, size_t model_data_length, bool debug) { - Ort::Env env(ORT_LOGGING_LEVEL_WARNING); + Ort::Env env(ORT_LOGGING_LEVEL_ERROR); Ort::SessionOptions sess_opts; sess_opts.SetIntraOpNumThreads(1); sess_opts.SetInterOpNumThreads(1); diff --git a/sherpa-onnx/csrc/online-transducer-nemo-model.cc b/sherpa-onnx/csrc/online-transducer-nemo-model.cc index 8882c6caa5..4e12da44c8 100644 --- a/sherpa-onnx/csrc/online-transducer-nemo-model.cc +++ b/sherpa-onnx/csrc/online-transducer-nemo-model.cc @@ -35,7 +35,7 @@ class OnlineTransducerNeMoModel::Impl { public: explicit Impl(const OnlineModelConfig &config) : config_(config), - env_(ORT_LOGGING_LEVEL_WARNING), + env_(ORT_LOGGING_LEVEL_ERROR), sess_opts_(GetSessionOptions(config)), allocator_{} { { @@ -57,7 +57,7 @@ class OnlineTransducerNeMoModel::Impl { #if __ANDROID_API__ >= 9 Impl(AAssetManager *mgr, const OnlineModelConfig &config) : config_(config), - env_(ORT_LOGGING_LEVEL_WARNING), + env_(ORT_LOGGING_LEVEL_ERROR), sess_opts_(GetSessionOptions(config)), allocator_{} { { diff --git a/sherpa-onnx/csrc/online-wenet-ctc-model.cc b/sherpa-onnx/csrc/online-wenet-ctc-model.cc index 793d4eb0cf..1b1605183b 100644 --- a/sherpa-onnx/csrc/online-wenet-ctc-model.cc +++ b/sherpa-onnx/csrc/online-wenet-ctc-model.cc @@ -36,7 +36,7 @@ class OnlineWenetCtcModel::Impl { #if __ANDROID_API__ >= 9 Impl(AAssetManager *mgr, const OnlineModelConfig &config) : config_(config), - env_(ORT_LOGGING_LEVEL_WARNING), + env_(ORT_LOGGING_LEVEL_ERROR), sess_opts_(GetSessionOptions(config)), allocator_{} { { diff --git a/sherpa-onnx/csrc/online-zipformer-transducer-model.cc b/sherpa-onnx/csrc/online-zipformer-transducer-model.cc index 2c9b973744..324b2b0886 100644 --- a/sherpa-onnx/csrc/online-zipformer-transducer-model.cc +++ b/sherpa-onnx/csrc/online-zipformer-transducer-model.cc @@ -30,7 +30,7 @@ namespace sherpa_onnx { OnlineZipformerTransducerModel::OnlineZipformerTransducerModel( const OnlineModelConfig &config) - : env_(ORT_LOGGING_LEVEL_WARNING), + : env_(ORT_LOGGING_LEVEL_ERROR), config_(config), sess_opts_(GetSessionOptions(config)), allocator_{} { @@ -53,7 +53,7 @@ OnlineZipformerTransducerModel::OnlineZipformerTransducerModel( #if __ANDROID_API__ >= 9 OnlineZipformerTransducerModel::OnlineZipformerTransducerModel( AAssetManager *mgr, const OnlineModelConfig &config) - : env_(ORT_LOGGING_LEVEL_WARNING), + : env_(ORT_LOGGING_LEVEL_ERROR), config_(config), sess_opts_(GetSessionOptions(config)), allocator_{} { diff --git a/sherpa-onnx/csrc/online-zipformer2-ctc-model.cc b/sherpa-onnx/csrc/online-zipformer2-ctc-model.cc index 3dc3eedfca..04699a56b5 100644 --- a/sherpa-onnx/csrc/online-zipformer2-ctc-model.cc +++ b/sherpa-onnx/csrc/online-zipformer2-ctc-model.cc @@ -40,7 +40,7 @@ class OnlineZipformer2CtcModel::Impl { #if __ANDROID_API__ >= 9 Impl(AAssetManager *mgr, const OnlineModelConfig &config) : config_(config), - env_(ORT_LOGGING_LEVEL_WARNING), + env_(ORT_LOGGING_LEVEL_ERROR), sess_opts_(GetSessionOptions(config)), allocator_{} { { diff --git a/sherpa-onnx/csrc/online-zipformer2-transducer-model.cc b/sherpa-onnx/csrc/online-zipformer2-transducer-model.cc index b6cb3e1737..0782f06fcb 100644 --- a/sherpa-onnx/csrc/online-zipformer2-transducer-model.cc +++ b/sherpa-onnx/csrc/online-zipformer2-transducer-model.cc @@ -32,7 +32,7 @@ namespace sherpa_onnx { OnlineZipformer2TransducerModel::OnlineZipformer2TransducerModel( const OnlineModelConfig &config) - : env_(ORT_LOGGING_LEVEL_WARNING), + : env_(ORT_LOGGING_LEVEL_ERROR), encoder_sess_opts_(GetSessionOptions(config)), decoder_sess_opts_(GetSessionOptions(config, "decoder")), joiner_sess_opts_(GetSessionOptions(config, "joiner")), @@ -57,7 +57,7 @@ OnlineZipformer2TransducerModel::OnlineZipformer2TransducerModel( #if __ANDROID_API__ >= 9 OnlineZipformer2TransducerModel::OnlineZipformer2TransducerModel( AAssetManager *mgr, const OnlineModelConfig &config) - : env_(ORT_LOGGING_LEVEL_WARNING), + : env_(ORT_LOGGING_LEVEL_ERROR), config_(config), encoder_sess_opts_(GetSessionOptions(config)), decoder_sess_opts_(GetSessionOptions(config)), @@ -82,8 +82,8 @@ OnlineZipformer2TransducerModel::OnlineZipformer2TransducerModel( void OnlineZipformer2TransducerModel::InitEncoder(void *model_data, size_t model_data_length) { - encoder_sess_ = std::make_unique(env_, model_data, - model_data_length, encoder_sess_opts_); + encoder_sess_ = std::make_unique( + env_, model_data, model_data_length, encoder_sess_opts_); GetInputNames(encoder_sess_.get(), &encoder_input_names_, &encoder_input_names_ptr_); @@ -135,8 +135,8 @@ void OnlineZipformer2TransducerModel::InitEncoder(void *model_data, void OnlineZipformer2TransducerModel::InitDecoder(void *model_data, size_t model_data_length) { - decoder_sess_ = std::make_unique(env_, model_data, - model_data_length, decoder_sess_opts_); + decoder_sess_ = std::make_unique( + env_, model_data, model_data_length, decoder_sess_opts_); GetInputNames(decoder_sess_.get(), &decoder_input_names_, &decoder_input_names_ptr_); @@ -160,8 +160,8 @@ void OnlineZipformer2TransducerModel::InitDecoder(void *model_data, void OnlineZipformer2TransducerModel::InitJoiner(void *model_data, size_t model_data_length) { - joiner_sess_ = std::make_unique(env_, model_data, - model_data_length, joiner_sess_opts_); + joiner_sess_ = std::make_unique( + env_, model_data, model_data_length, joiner_sess_opts_); GetInputNames(joiner_sess_.get(), &joiner_input_names_, &joiner_input_names_ptr_); diff --git a/sherpa-onnx/csrc/speaker-embedding-extractor-impl.cc b/sherpa-onnx/csrc/speaker-embedding-extractor-impl.cc index fac2ea6546..4dafce91db 100644 --- a/sherpa-onnx/csrc/speaker-embedding-extractor-impl.cc +++ b/sherpa-onnx/csrc/speaker-embedding-extractor-impl.cc @@ -23,7 +23,7 @@ enum class ModelType : std::uint8_t { static ModelType GetModelType(char *model_data, size_t model_data_length, bool debug) { - Ort::Env env(ORT_LOGGING_LEVEL_WARNING); + Ort::Env env(ORT_LOGGING_LEVEL_ERROR); Ort::SessionOptions sess_opts; sess_opts.SetIntraOpNumThreads(1); sess_opts.SetInterOpNumThreads(1); diff --git a/sherpa-onnx/csrc/spoken-language-identification-impl.cc b/sherpa-onnx/csrc/spoken-language-identification-impl.cc index b8984a66f6..109b48789e 100644 --- a/sherpa-onnx/csrc/spoken-language-identification-impl.cc +++ b/sherpa-onnx/csrc/spoken-language-identification-impl.cc @@ -27,7 +27,7 @@ enum class ModelType : std::uint8_t { static ModelType GetModelType(char *model_data, size_t model_data_length, bool debug) { - Ort::Env env(ORT_LOGGING_LEVEL_WARNING); + Ort::Env env(ORT_LOGGING_LEVEL_ERROR); Ort::SessionOptions sess_opts; auto sess = std::make_unique(env, model_data, model_data_length,