Fangjun Kuang
Committed by GitHub

Reduce onnxruntime log output. (#1306)

Change the logging level from WARNING to ERROR.
@@ -35,7 +35,7 @@ namespace sherpa_onnx { @@ -35,7 +35,7 @@ namespace sherpa_onnx {
35 35
36 static ModelType GetModelType(char *model_data, size_t model_data_length, 36 static ModelType GetModelType(char *model_data, size_t model_data_length,
37 bool debug) { 37 bool debug) {
38 - Ort::Env env(ORT_LOGGING_LEVEL_WARNING); 38 + Ort::Env env(ORT_LOGGING_LEVEL_ERROR);
39 Ort::SessionOptions sess_opts; 39 Ort::SessionOptions sess_opts;
40 sess_opts.SetIntraOpNumThreads(1); 40 sess_opts.SetIntraOpNumThreads(1);
41 sess_opts.SetInterOpNumThreads(1); 41 sess_opts.SetInterOpNumThreads(1);
@@ -19,7 +19,7 @@ class OfflineTransducerModel::Impl { @@ -19,7 +19,7 @@ class OfflineTransducerModel::Impl {
19 public: 19 public:
20 explicit Impl(const OfflineModelConfig &config) 20 explicit Impl(const OfflineModelConfig &config)
21 : config_(config), 21 : config_(config),
22 - env_(ORT_LOGGING_LEVEL_WARNING), 22 + env_(ORT_LOGGING_LEVEL_ERROR),
23 sess_opts_(GetSessionOptions(config)), 23 sess_opts_(GetSessionOptions(config)),
24 allocator_{} { 24 allocator_{} {
25 { 25 {
@@ -41,7 +41,7 @@ class OfflineTransducerModel::Impl { @@ -41,7 +41,7 @@ class OfflineTransducerModel::Impl {
41 #if __ANDROID_API__ >= 9 41 #if __ANDROID_API__ >= 9
42 Impl(AAssetManager *mgr, const OfflineModelConfig &config) 42 Impl(AAssetManager *mgr, const OfflineModelConfig &config)
43 : config_(config), 43 : config_(config),
44 - env_(ORT_LOGGING_LEVEL_WARNING), 44 + env_(ORT_LOGGING_LEVEL_ERROR),
45 sess_opts_(GetSessionOptions(config)), 45 sess_opts_(GetSessionOptions(config)),
46 allocator_{} { 46 allocator_{} {
47 { 47 {
@@ -21,7 +21,7 @@ class OfflineTransducerNeMoModel::Impl { @@ -21,7 +21,7 @@ class OfflineTransducerNeMoModel::Impl {
21 public: 21 public:
22 explicit Impl(const OfflineModelConfig &config) 22 explicit Impl(const OfflineModelConfig &config)
23 : config_(config), 23 : config_(config),
24 - env_(ORT_LOGGING_LEVEL_WARNING), 24 + env_(ORT_LOGGING_LEVEL_ERROR),
25 sess_opts_(GetSessionOptions(config)), 25 sess_opts_(GetSessionOptions(config)),
26 allocator_{} { 26 allocator_{} {
27 { 27 {
@@ -43,7 +43,7 @@ class OfflineTransducerNeMoModel::Impl { @@ -43,7 +43,7 @@ class OfflineTransducerNeMoModel::Impl {
43 #if __ANDROID_API__ >= 9 43 #if __ANDROID_API__ >= 9
44 Impl(AAssetManager *mgr, const OfflineModelConfig &config) 44 Impl(AAssetManager *mgr, const OfflineModelConfig &config)
45 : config_(config), 45 : config_(config),
46 - env_(ORT_LOGGING_LEVEL_WARNING), 46 + env_(ORT_LOGGING_LEVEL_ERROR),
47 sess_opts_(GetSessionOptions(config)), 47 sess_opts_(GetSessionOptions(config)),
48 allocator_{} { 48 allocator_{} {
49 { 49 {
@@ -19,7 +19,7 @@ class OfflineTtsVitsModel::Impl { @@ -19,7 +19,7 @@ class OfflineTtsVitsModel::Impl {
19 public: 19 public:
20 explicit Impl(const OfflineTtsModelConfig &config) 20 explicit Impl(const OfflineTtsModelConfig &config)
21 : config_(config), 21 : config_(config),
22 - env_(ORT_LOGGING_LEVEL_WARNING), 22 + env_(ORT_LOGGING_LEVEL_ERROR),
23 sess_opts_(GetSessionOptions(config)), 23 sess_opts_(GetSessionOptions(config)),
24 allocator_{} { 24 allocator_{} {
25 auto buf = ReadFile(config.vits.model); 25 auto buf = ReadFile(config.vits.model);
@@ -29,7 +29,7 @@ class OfflineTtsVitsModel::Impl { @@ -29,7 +29,7 @@ class OfflineTtsVitsModel::Impl {
29 #if __ANDROID_API__ >= 9 29 #if __ANDROID_API__ >= 9
30 Impl(AAssetManager *mgr, const OfflineTtsModelConfig &config) 30 Impl(AAssetManager *mgr, const OfflineTtsModelConfig &config)
31 : config_(config), 31 : config_(config),
32 - env_(ORT_LOGGING_LEVEL_WARNING), 32 + env_(ORT_LOGGING_LEVEL_ERROR),
33 sess_opts_(GetSessionOptions(config)), 33 sess_opts_(GetSessionOptions(config)),
34 allocator_{} { 34 allocator_{} {
35 auto buf = ReadFile(mgr, config.vits.model); 35 auto buf = ReadFile(mgr, config.vits.model);
@@ -30,7 +30,7 @@ namespace sherpa_onnx { @@ -30,7 +30,7 @@ namespace sherpa_onnx {
30 30
31 OnlineConformerTransducerModel::OnlineConformerTransducerModel( 31 OnlineConformerTransducerModel::OnlineConformerTransducerModel(
32 const OnlineModelConfig &config) 32 const OnlineModelConfig &config)
33 - : env_(ORT_LOGGING_LEVEL_WARNING), 33 + : env_(ORT_LOGGING_LEVEL_ERROR),
34 config_(config), 34 config_(config),
35 sess_opts_(GetSessionOptions(config)), 35 sess_opts_(GetSessionOptions(config)),
36 allocator_{} { 36 allocator_{} {
@@ -53,7 +53,7 @@ OnlineConformerTransducerModel::OnlineConformerTransducerModel( @@ -53,7 +53,7 @@ OnlineConformerTransducerModel::OnlineConformerTransducerModel(
53 #if __ANDROID_API__ >= 9 53 #if __ANDROID_API__ >= 9
54 OnlineConformerTransducerModel::OnlineConformerTransducerModel( 54 OnlineConformerTransducerModel::OnlineConformerTransducerModel(
55 AAssetManager *mgr, const OnlineModelConfig &config) 55 AAssetManager *mgr, const OnlineModelConfig &config)
56 - : env_(ORT_LOGGING_LEVEL_WARNING), 56 + : env_(ORT_LOGGING_LEVEL_ERROR),
57 config_(config), 57 config_(config),
58 sess_opts_(GetSessionOptions(config)), 58 sess_opts_(GetSessionOptions(config)),
59 allocator_{} { 59 allocator_{} {
@@ -28,7 +28,7 @@ namespace sherpa_onnx { @@ -28,7 +28,7 @@ namespace sherpa_onnx {
28 28
29 OnlineLstmTransducerModel::OnlineLstmTransducerModel( 29 OnlineLstmTransducerModel::OnlineLstmTransducerModel(
30 const OnlineModelConfig &config) 30 const OnlineModelConfig &config)
31 - : env_(ORT_LOGGING_LEVEL_WARNING), 31 + : env_(ORT_LOGGING_LEVEL_ERROR),
32 config_(config), 32 config_(config),
33 sess_opts_(GetSessionOptions(config)), 33 sess_opts_(GetSessionOptions(config)),
34 allocator_{} { 34 allocator_{} {
@@ -51,7 +51,7 @@ OnlineLstmTransducerModel::OnlineLstmTransducerModel( @@ -51,7 +51,7 @@ OnlineLstmTransducerModel::OnlineLstmTransducerModel(
51 #if __ANDROID_API__ >= 9 51 #if __ANDROID_API__ >= 9
52 OnlineLstmTransducerModel::OnlineLstmTransducerModel( 52 OnlineLstmTransducerModel::OnlineLstmTransducerModel(
53 AAssetManager *mgr, const OnlineModelConfig &config) 53 AAssetManager *mgr, const OnlineModelConfig &config)
54 - : env_(ORT_LOGGING_LEVEL_WARNING), 54 + : env_(ORT_LOGGING_LEVEL_ERROR),
55 config_(config), 55 config_(config),
56 sess_opts_(GetSessionOptions(config)), 56 sess_opts_(GetSessionOptions(config)),
57 allocator_{} { 57 allocator_{} {
@@ -39,7 +39,7 @@ class OnlineNeMoCtcModel::Impl { @@ -39,7 +39,7 @@ class OnlineNeMoCtcModel::Impl {
39 #if __ANDROID_API__ >= 9 39 #if __ANDROID_API__ >= 9
40 Impl(AAssetManager *mgr, const OnlineModelConfig &config) 40 Impl(AAssetManager *mgr, const OnlineModelConfig &config)
41 : config_(config), 41 : config_(config),
42 - env_(ORT_LOGGING_LEVEL_WARNING), 42 + env_(ORT_LOGGING_LEVEL_ERROR),
43 sess_opts_(GetSessionOptions(config)), 43 sess_opts_(GetSessionOptions(config)),
44 allocator_{} { 44 allocator_{} {
45 { 45 {
@@ -41,7 +41,7 @@ class OnlineParaformerModel::Impl { @@ -41,7 +41,7 @@ class OnlineParaformerModel::Impl {
41 #if __ANDROID_API__ >= 9 41 #if __ANDROID_API__ >= 9
42 Impl(AAssetManager *mgr, const OnlineModelConfig &config) 42 Impl(AAssetManager *mgr, const OnlineModelConfig &config)
43 : config_(config), 43 : config_(config),
44 - env_(ORT_LOGGING_LEVEL_WARNING), 44 + env_(ORT_LOGGING_LEVEL_ERROR),
45 sess_opts_(GetSessionOptions(config)), 45 sess_opts_(GetSessionOptions(config)),
46 allocator_{} { 46 allocator_{} {
47 { 47 {
@@ -28,7 +28,7 @@ namespace sherpa_onnx { @@ -28,7 +28,7 @@ namespace sherpa_onnx {
28 std::unique_ptr<OnlineRecognizerImpl> OnlineRecognizerImpl::Create( 28 std::unique_ptr<OnlineRecognizerImpl> OnlineRecognizerImpl::Create(
29 const OnlineRecognizerConfig &config) { 29 const OnlineRecognizerConfig &config) {
30 if (!config.model_config.transducer.encoder.empty()) { 30 if (!config.model_config.transducer.encoder.empty()) {
31 - Ort::Env env(ORT_LOGGING_LEVEL_WARNING); 31 + Ort::Env env(ORT_LOGGING_LEVEL_ERROR);
32 32
33 auto decoder_model = ReadFile(config.model_config.transducer.decoder); 33 auto decoder_model = ReadFile(config.model_config.transducer.decoder);
34 auto sess = std::make_unique<Ort::Session>( 34 auto sess = std::make_unique<Ort::Session>(
@@ -61,7 +61,7 @@ std::unique_ptr<OnlineRecognizerImpl> OnlineRecognizerImpl::Create( @@ -61,7 +61,7 @@ std::unique_ptr<OnlineRecognizerImpl> OnlineRecognizerImpl::Create(
61 std::unique_ptr<OnlineRecognizerImpl> OnlineRecognizerImpl::Create( 61 std::unique_ptr<OnlineRecognizerImpl> OnlineRecognizerImpl::Create(
62 AAssetManager *mgr, const OnlineRecognizerConfig &config) { 62 AAssetManager *mgr, const OnlineRecognizerConfig &config) {
63 if (!config.model_config.transducer.encoder.empty()) { 63 if (!config.model_config.transducer.encoder.empty()) {
64 - Ort::Env env(ORT_LOGGING_LEVEL_WARNING); 64 + Ort::Env env(ORT_LOGGING_LEVEL_ERROR);
65 65
66 auto decoder_model = ReadFile(mgr, config.model_config.transducer.decoder); 66 auto decoder_model = ReadFile(mgr, config.model_config.transducer.decoder);
67 auto sess = std::make_unique<Ort::Session>( 67 auto sess = std::make_unique<Ort::Session>(
@@ -37,7 +37,7 @@ namespace sherpa_onnx { @@ -37,7 +37,7 @@ namespace sherpa_onnx {
37 37
38 static ModelType GetModelType(char *model_data, size_t model_data_length, 38 static ModelType GetModelType(char *model_data, size_t model_data_length,
39 bool debug) { 39 bool debug) {
40 - Ort::Env env(ORT_LOGGING_LEVEL_WARNING); 40 + Ort::Env env(ORT_LOGGING_LEVEL_ERROR);
41 Ort::SessionOptions sess_opts; 41 Ort::SessionOptions sess_opts;
42 sess_opts.SetIntraOpNumThreads(1); 42 sess_opts.SetIntraOpNumThreads(1);
43 sess_opts.SetInterOpNumThreads(1); 43 sess_opts.SetInterOpNumThreads(1);
@@ -35,7 +35,7 @@ class OnlineTransducerNeMoModel::Impl { @@ -35,7 +35,7 @@ class OnlineTransducerNeMoModel::Impl {
35 public: 35 public:
36 explicit Impl(const OnlineModelConfig &config) 36 explicit Impl(const OnlineModelConfig &config)
37 : config_(config), 37 : config_(config),
38 - env_(ORT_LOGGING_LEVEL_WARNING), 38 + env_(ORT_LOGGING_LEVEL_ERROR),
39 sess_opts_(GetSessionOptions(config)), 39 sess_opts_(GetSessionOptions(config)),
40 allocator_{} { 40 allocator_{} {
41 { 41 {
@@ -57,7 +57,7 @@ class OnlineTransducerNeMoModel::Impl { @@ -57,7 +57,7 @@ class OnlineTransducerNeMoModel::Impl {
57 #if __ANDROID_API__ >= 9 57 #if __ANDROID_API__ >= 9
58 Impl(AAssetManager *mgr, const OnlineModelConfig &config) 58 Impl(AAssetManager *mgr, const OnlineModelConfig &config)
59 : config_(config), 59 : config_(config),
60 - env_(ORT_LOGGING_LEVEL_WARNING), 60 + env_(ORT_LOGGING_LEVEL_ERROR),
61 sess_opts_(GetSessionOptions(config)), 61 sess_opts_(GetSessionOptions(config)),
62 allocator_{} { 62 allocator_{} {
63 { 63 {
@@ -36,7 +36,7 @@ class OnlineWenetCtcModel::Impl { @@ -36,7 +36,7 @@ class OnlineWenetCtcModel::Impl {
36 #if __ANDROID_API__ >= 9 36 #if __ANDROID_API__ >= 9
37 Impl(AAssetManager *mgr, const OnlineModelConfig &config) 37 Impl(AAssetManager *mgr, const OnlineModelConfig &config)
38 : config_(config), 38 : config_(config),
39 - env_(ORT_LOGGING_LEVEL_WARNING), 39 + env_(ORT_LOGGING_LEVEL_ERROR),
40 sess_opts_(GetSessionOptions(config)), 40 sess_opts_(GetSessionOptions(config)),
41 allocator_{} { 41 allocator_{} {
42 { 42 {
@@ -30,7 +30,7 @@ namespace sherpa_onnx { @@ -30,7 +30,7 @@ namespace sherpa_onnx {
30 30
31 OnlineZipformerTransducerModel::OnlineZipformerTransducerModel( 31 OnlineZipformerTransducerModel::OnlineZipformerTransducerModel(
32 const OnlineModelConfig &config) 32 const OnlineModelConfig &config)
33 - : env_(ORT_LOGGING_LEVEL_WARNING), 33 + : env_(ORT_LOGGING_LEVEL_ERROR),
34 config_(config), 34 config_(config),
35 sess_opts_(GetSessionOptions(config)), 35 sess_opts_(GetSessionOptions(config)),
36 allocator_{} { 36 allocator_{} {
@@ -53,7 +53,7 @@ OnlineZipformerTransducerModel::OnlineZipformerTransducerModel( @@ -53,7 +53,7 @@ OnlineZipformerTransducerModel::OnlineZipformerTransducerModel(
53 #if __ANDROID_API__ >= 9 53 #if __ANDROID_API__ >= 9
54 OnlineZipformerTransducerModel::OnlineZipformerTransducerModel( 54 OnlineZipformerTransducerModel::OnlineZipformerTransducerModel(
55 AAssetManager *mgr, const OnlineModelConfig &config) 55 AAssetManager *mgr, const OnlineModelConfig &config)
56 - : env_(ORT_LOGGING_LEVEL_WARNING), 56 + : env_(ORT_LOGGING_LEVEL_ERROR),
57 config_(config), 57 config_(config),
58 sess_opts_(GetSessionOptions(config)), 58 sess_opts_(GetSessionOptions(config)),
59 allocator_{} { 59 allocator_{} {
@@ -40,7 +40,7 @@ class OnlineZipformer2CtcModel::Impl { @@ -40,7 +40,7 @@ class OnlineZipformer2CtcModel::Impl {
40 #if __ANDROID_API__ >= 9 40 #if __ANDROID_API__ >= 9
41 Impl(AAssetManager *mgr, const OnlineModelConfig &config) 41 Impl(AAssetManager *mgr, const OnlineModelConfig &config)
42 : config_(config), 42 : config_(config),
43 - env_(ORT_LOGGING_LEVEL_WARNING), 43 + env_(ORT_LOGGING_LEVEL_ERROR),
44 sess_opts_(GetSessionOptions(config)), 44 sess_opts_(GetSessionOptions(config)),
45 allocator_{} { 45 allocator_{} {
46 { 46 {
@@ -32,7 +32,7 @@ namespace sherpa_onnx { @@ -32,7 +32,7 @@ namespace sherpa_onnx {
32 32
33 OnlineZipformer2TransducerModel::OnlineZipformer2TransducerModel( 33 OnlineZipformer2TransducerModel::OnlineZipformer2TransducerModel(
34 const OnlineModelConfig &config) 34 const OnlineModelConfig &config)
35 - : env_(ORT_LOGGING_LEVEL_WARNING), 35 + : env_(ORT_LOGGING_LEVEL_ERROR),
36 encoder_sess_opts_(GetSessionOptions(config)), 36 encoder_sess_opts_(GetSessionOptions(config)),
37 decoder_sess_opts_(GetSessionOptions(config, "decoder")), 37 decoder_sess_opts_(GetSessionOptions(config, "decoder")),
38 joiner_sess_opts_(GetSessionOptions(config, "joiner")), 38 joiner_sess_opts_(GetSessionOptions(config, "joiner")),
@@ -57,7 +57,7 @@ OnlineZipformer2TransducerModel::OnlineZipformer2TransducerModel( @@ -57,7 +57,7 @@ OnlineZipformer2TransducerModel::OnlineZipformer2TransducerModel(
57 #if __ANDROID_API__ >= 9 57 #if __ANDROID_API__ >= 9
58 OnlineZipformer2TransducerModel::OnlineZipformer2TransducerModel( 58 OnlineZipformer2TransducerModel::OnlineZipformer2TransducerModel(
59 AAssetManager *mgr, const OnlineModelConfig &config) 59 AAssetManager *mgr, const OnlineModelConfig &config)
60 - : env_(ORT_LOGGING_LEVEL_WARNING), 60 + : env_(ORT_LOGGING_LEVEL_ERROR),
61 config_(config), 61 config_(config),
62 encoder_sess_opts_(GetSessionOptions(config)), 62 encoder_sess_opts_(GetSessionOptions(config)),
63 decoder_sess_opts_(GetSessionOptions(config)), 63 decoder_sess_opts_(GetSessionOptions(config)),
@@ -82,8 +82,8 @@ OnlineZipformer2TransducerModel::OnlineZipformer2TransducerModel( @@ -82,8 +82,8 @@ OnlineZipformer2TransducerModel::OnlineZipformer2TransducerModel(
82 82
83 void OnlineZipformer2TransducerModel::InitEncoder(void *model_data, 83 void OnlineZipformer2TransducerModel::InitEncoder(void *model_data,
84 size_t model_data_length) { 84 size_t model_data_length) {
85 - encoder_sess_ = std::make_unique<Ort::Session>(env_, model_data,  
86 - model_data_length, encoder_sess_opts_); 85 + encoder_sess_ = std::make_unique<Ort::Session>(
  86 + env_, model_data, model_data_length, encoder_sess_opts_);
87 87
88 GetInputNames(encoder_sess_.get(), &encoder_input_names_, 88 GetInputNames(encoder_sess_.get(), &encoder_input_names_,
89 &encoder_input_names_ptr_); 89 &encoder_input_names_ptr_);
@@ -135,8 +135,8 @@ void OnlineZipformer2TransducerModel::InitEncoder(void *model_data, @@ -135,8 +135,8 @@ void OnlineZipformer2TransducerModel::InitEncoder(void *model_data,
135 135
136 void OnlineZipformer2TransducerModel::InitDecoder(void *model_data, 136 void OnlineZipformer2TransducerModel::InitDecoder(void *model_data,
137 size_t model_data_length) { 137 size_t model_data_length) {
138 - decoder_sess_ = std::make_unique<Ort::Session>(env_, model_data,  
139 - model_data_length, decoder_sess_opts_); 138 + decoder_sess_ = std::make_unique<Ort::Session>(
  139 + env_, model_data, model_data_length, decoder_sess_opts_);
140 140
141 GetInputNames(decoder_sess_.get(), &decoder_input_names_, 141 GetInputNames(decoder_sess_.get(), &decoder_input_names_,
142 &decoder_input_names_ptr_); 142 &decoder_input_names_ptr_);
@@ -160,8 +160,8 @@ void OnlineZipformer2TransducerModel::InitDecoder(void *model_data, @@ -160,8 +160,8 @@ void OnlineZipformer2TransducerModel::InitDecoder(void *model_data,
160 160
161 void OnlineZipformer2TransducerModel::InitJoiner(void *model_data, 161 void OnlineZipformer2TransducerModel::InitJoiner(void *model_data,
162 size_t model_data_length) { 162 size_t model_data_length) {
163 - joiner_sess_ = std::make_unique<Ort::Session>(env_, model_data,  
164 - model_data_length, joiner_sess_opts_); 163 + joiner_sess_ = std::make_unique<Ort::Session>(
  164 + env_, model_data, model_data_length, joiner_sess_opts_);
165 165
166 GetInputNames(joiner_sess_.get(), &joiner_input_names_, 166 GetInputNames(joiner_sess_.get(), &joiner_input_names_,
167 &joiner_input_names_ptr_); 167 &joiner_input_names_ptr_);
@@ -23,7 +23,7 @@ enum class ModelType : std::uint8_t { @@ -23,7 +23,7 @@ enum class ModelType : std::uint8_t {
23 23
24 static ModelType GetModelType(char *model_data, size_t model_data_length, 24 static ModelType GetModelType(char *model_data, size_t model_data_length,
25 bool debug) { 25 bool debug) {
26 - Ort::Env env(ORT_LOGGING_LEVEL_WARNING); 26 + Ort::Env env(ORT_LOGGING_LEVEL_ERROR);
27 Ort::SessionOptions sess_opts; 27 Ort::SessionOptions sess_opts;
28 sess_opts.SetIntraOpNumThreads(1); 28 sess_opts.SetIntraOpNumThreads(1);
29 sess_opts.SetInterOpNumThreads(1); 29 sess_opts.SetInterOpNumThreads(1);
@@ -27,7 +27,7 @@ enum class ModelType : std::uint8_t { @@ -27,7 +27,7 @@ enum class ModelType : std::uint8_t {
27 27
28 static ModelType GetModelType(char *model_data, size_t model_data_length, 28 static ModelType GetModelType(char *model_data, size_t model_data_length,
29 bool debug) { 29 bool debug) {
30 - Ort::Env env(ORT_LOGGING_LEVEL_WARNING); 30 + Ort::Env env(ORT_LOGGING_LEVEL_ERROR);
31 Ort::SessionOptions sess_opts; 31 Ort::SessionOptions sess_opts;
32 32
33 auto sess = std::make_unique<Ort::Session>(env, model_data, model_data_length, 33 auto sess = std::make_unique<Ort::Session>(env, model_data, model_data_length,