Skip to content

Commit

Permalink
Only set preferredOutputLocation if shapes are present
Browse files Browse the repository at this point in the history
  • Loading branch information
xenova committed Jun 4, 2024
1 parent 24d706d commit c9ef76c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,14 @@ async function getSession(pretrained_model_name_or_path, fileName, options) {
const shapes = getKeyValueShapes(options.config, {
prefix: 'present',
});
const preferredOutputLocation = {};
for (const key in shapes) {
preferredOutputLocation[key] = 'gpu-buffer';
if (Object.keys(shapes).length > 0) {
// Only set preferredOutputLocation if shapes are present
const preferredOutputLocation = {};
for (const key in shapes) {
preferredOutputLocation[key] = 'gpu-buffer';
}
session_options.preferredOutputLocation = preferredOutputLocation;
}
session_options.preferredOutputLocation = preferredOutputLocation;
}

const buffer = await bufferPromise;
Expand Down

0 comments on commit c9ef76c

Please sign in to comment.