Use a single thread when loading models (#703)
This commit is contained in:
@@ -34,6 +34,8 @@ static ModelType GetModelType(char *model_data, size_t model_data_length,
|
||||
bool debug) {
|
||||
Ort::Env env(ORT_LOGGING_LEVEL_WARNING);
|
||||
Ort::SessionOptions sess_opts;
|
||||
sess_opts.SetIntraOpNumThreads(1);
|
||||
sess_opts.SetInterOpNumThreads(1);
|
||||
|
||||
auto sess = std::make_unique<Ort::Session>(env, model_data, model_data_length,
|
||||
sess_opts);
|
||||
|
||||
@@ -40,6 +40,9 @@ std::unique_ptr<OfflineRecognizerImpl> OfflineRecognizerImpl::Create(
|
||||
Ort::Env env(ORT_LOGGING_LEVEL_ERROR);
|
||||
|
||||
Ort::SessionOptions sess_opts;
|
||||
sess_opts.SetIntraOpNumThreads(1);
|
||||
sess_opts.SetInterOpNumThreads(1);
|
||||
|
||||
std::string model_filename;
|
||||
if (!config.model_config.transducer.encoder_filename.empty()) {
|
||||
model_filename = config.model_config.transducer.encoder_filename;
|
||||
@@ -167,6 +170,9 @@ std::unique_ptr<OfflineRecognizerImpl> OfflineRecognizerImpl::Create(
|
||||
Ort::Env env(ORT_LOGGING_LEVEL_ERROR);
|
||||
|
||||
Ort::SessionOptions sess_opts;
|
||||
sess_opts.SetIntraOpNumThreads(1);
|
||||
sess_opts.SetInterOpNumThreads(1);
|
||||
|
||||
std::string model_filename;
|
||||
if (!config.model_config.transducer.encoder_filename.empty()) {
|
||||
model_filename = config.model_config.transducer.encoder_filename;
|
||||
|
||||
@@ -39,6 +39,8 @@ static ModelType GetModelType(char *model_data, size_t model_data_length,
|
||||
bool debug) {
|
||||
Ort::Env env(ORT_LOGGING_LEVEL_WARNING);
|
||||
Ort::SessionOptions sess_opts;
|
||||
sess_opts.SetIntraOpNumThreads(1);
|
||||
sess_opts.SetInterOpNumThreads(1);
|
||||
|
||||
auto sess = std::make_unique<Ort::Session>(env, model_data, model_data_length,
|
||||
sess_opts);
|
||||
|
||||
@@ -25,6 +25,8 @@ static ModelType GetModelType(char *model_data, size_t model_data_length,
|
||||
bool debug) {
|
||||
Ort::Env env(ORT_LOGGING_LEVEL_WARNING);
|
||||
Ort::SessionOptions sess_opts;
|
||||
sess_opts.SetIntraOpNumThreads(1);
|
||||
sess_opts.SetInterOpNumThreads(1);
|
||||
|
||||
auto sess = std::make_unique<Ort::Session>(env, model_data, model_data_length,
|
||||
sess_opts);
|
||||
|
||||
Reference in New Issue
Block a user