Skip to content

Commit

Permalink
Reduce onnxruntime log output. (#1306)
Browse files Browse the repository at this point in the history
Change the logging level from WARNING to ERROR.
  • Loading branch information
csukuangfj authored Aug 30, 2024
1 parent 6b8877f commit 3687c9f
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion sherpa-onnx/csrc/offline-ctc-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions sherpa-onnx/csrc/offline-transducer-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_{} {
{
Expand All @@ -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_{} {
{
Expand Down
4 changes: 2 additions & 2 deletions sherpa-onnx/csrc/offline-transducer-nemo-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_{} {
{
Expand All @@ -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_{} {
{
Expand Down
4 changes: 2 additions & 2 deletions sherpa-onnx/csrc/offline-tts-vits-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions sherpa-onnx/csrc/online-conformer-transducer-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_{} {
Expand All @@ -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_{} {
Expand Down
4 changes: 2 additions & 2 deletions sherpa-onnx/csrc/online-lstm-transducer-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_{} {
Expand All @@ -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_{} {
Expand Down
2 changes: 1 addition & 1 deletion sherpa-onnx/csrc/online-nemo-ctc-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_{} {
{
Expand Down
2 changes: 1 addition & 1 deletion sherpa-onnx/csrc/online-paraformer-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_{} {
{
Expand Down
4 changes: 2 additions & 2 deletions sherpa-onnx/csrc/online-recognizer-impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace sherpa_onnx {
std::unique_ptr<OnlineRecognizerImpl> 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<Ort::Session>(
Expand Down Expand Up @@ -61,7 +61,7 @@ std::unique_ptr<OnlineRecognizerImpl> OnlineRecognizerImpl::Create(
std::unique_ptr<OnlineRecognizerImpl> 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<Ort::Session>(
Expand Down
2 changes: 1 addition & 1 deletion sherpa-onnx/csrc/online-transducer-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions sherpa-onnx/csrc/online-transducer-nemo-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_{} {
{
Expand All @@ -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_{} {
{
Expand Down
2 changes: 1 addition & 1 deletion sherpa-onnx/csrc/online-wenet-ctc-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_{} {
{
Expand Down
4 changes: 2 additions & 2 deletions sherpa-onnx/csrc/online-zipformer-transducer-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_{} {
Expand All @@ -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_{} {
Expand Down
2 changes: 1 addition & 1 deletion sherpa-onnx/csrc/online-zipformer2-ctc-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_{} {
{
Expand Down
16 changes: 8 additions & 8 deletions sherpa-onnx/csrc/online-zipformer2-transducer-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand All @@ -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)),
Expand All @@ -82,8 +82,8 @@ OnlineZipformer2TransducerModel::OnlineZipformer2TransducerModel(

void OnlineZipformer2TransducerModel::InitEncoder(void *model_data,
size_t model_data_length) {
encoder_sess_ = std::make_unique<Ort::Session>(env_, model_data,
model_data_length, encoder_sess_opts_);
encoder_sess_ = std::make_unique<Ort::Session>(
env_, model_data, model_data_length, encoder_sess_opts_);

GetInputNames(encoder_sess_.get(), &encoder_input_names_,
&encoder_input_names_ptr_);
Expand Down Expand Up @@ -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<Ort::Session>(env_, model_data,
model_data_length, decoder_sess_opts_);
decoder_sess_ = std::make_unique<Ort::Session>(
env_, model_data, model_data_length, decoder_sess_opts_);

GetInputNames(decoder_sess_.get(), &decoder_input_names_,
&decoder_input_names_ptr_);
Expand All @@ -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<Ort::Session>(env_, model_data,
model_data_length, joiner_sess_opts_);
joiner_sess_ = std::make_unique<Ort::Session>(
env_, model_data, model_data_length, joiner_sess_opts_);

GetInputNames(joiner_sess_.get(), &joiner_input_names_,
&joiner_input_names_ptr_);
Expand Down
2 changes: 1 addition & 1 deletion sherpa-onnx/csrc/speaker-embedding-extractor-impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion sherpa-onnx/csrc/spoken-language-identification-impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<Ort::Session>(env, model_data, model_data_length,
Expand Down

0 comments on commit 3687c9f

Please sign in to comment.