Skip to content

Commit

Permalink
Merge branch 'merge' into bricks
Browse files Browse the repository at this point in the history
  • Loading branch information
hans00 committed Apr 3, 2024
2 parents 9af382c + 800a476 commit e9ed4e3
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,20 @@ const MODEL_CLASS_TO_NAME_MAPPING = new Map();
async function constructSession(pretrained_model_name_or_path, fileName, options) {
// TODO add option for user to force specify their desired execution provider

const sessionOptions = { executionProviders, ...options.session_options }

if (IS_BROWSER || !env.useFS || !env.allowLocalModels || !env.useCustomCache) {
let modelFileName = `onnx/${fileName}${options.quantized ? '_quantized' : ''}.onnx`;
let buffer = await getModelFile(pretrained_model_name_or_path, modelFileName, true, options);

return await InferenceSession.create(buffer, {
executionProviders,
...options.session_options,
});
return await InferenceSession.create(buffer, sessionOptions);
} else {
let modelFileName = `onnx/${fileName}.onnx`;
let modelPath = await getModelPath(pretrained_model_name_or_path, modelFileName, true, options);
// Download optional external data file
await getModelPath(pretrained_model_name_or_path, `${modelFileName}_data`, false, options);

return await InferenceSession.create(modelPath, {
executionProviders,
});
return await InferenceSession.create(modelPath, sessionOptions);
}
}

Expand Down

0 comments on commit e9ed4e3

Please sign in to comment.