mirror of
https://github.com/pstrueb/piper.git
synced 2026-05-19 12:08:01 +00:00
Before consolidated main
This commit is contained in:
@@ -16,15 +16,16 @@ struct ModelSession {
|
||||
vector<char *> outputNames;
|
||||
Ort::AllocatorWithDefaultOptions allocator;
|
||||
Ort::SessionOptions options;
|
||||
Ort::Env env;
|
||||
|
||||
ModelSession() : onnx(nullptr){};
|
||||
};
|
||||
|
||||
void loadModel(string modelPath, ModelSession &session) {
|
||||
|
||||
Ort::Env env(OrtLoggingLevel::ORT_LOGGING_LEVEL_WARNING,
|
||||
instanceName.c_str());
|
||||
env.DisableTelemetryEvents();
|
||||
session.env = Ort::Env(OrtLoggingLevel::ORT_LOGGING_LEVEL_WARNING,
|
||||
instanceName.c_str());
|
||||
session.env.DisableTelemetryEvents();
|
||||
|
||||
// Slows down performance by ~2x
|
||||
// session.options.SetIntraOpNumThreads(1);
|
||||
@@ -44,7 +45,7 @@ void loadModel(string modelPath, ModelSession &session) {
|
||||
session.options.DisableProfiling();
|
||||
|
||||
auto startTime = chrono::steady_clock::now();
|
||||
session.onnx = Ort::Session(env, modelPath.c_str(), session.options);
|
||||
session.onnx = Ort::Session(session.env, modelPath.c_str(), session.options);
|
||||
auto endTime = chrono::steady_clock::now();
|
||||
auto loadDuration = chrono::duration<double>(endTime - startTime);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user