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 {
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);
... ...
... ... @@ -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_{} {
{
... ...
... ... @@ -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_{} {
{
... ...
... ... @@ -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);
... ...
... ... @@ -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_{} {
... ...
... ... @@ -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_{} {
... ...
... ... @@ -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_{} {
{
... ...
... ... @@ -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_{} {
{
... ...
... ... @@ -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>(
... ... @@ -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>(
... ...
... ... @@ -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);
... ...
... ... @@ -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_{} {
{
... ...
... ... @@ -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_{} {
{
... ...
... ... @@ -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_{} {
... ...
... ... @@ -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_{} {
{
... ...
... ... @@ -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<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_);
... ... @@ -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_);
... ... @@ -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_);
... ...
... ... @@ -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);
... ...
... ... @@ -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,
... ...