Skip to content

Commit

Permalink
Only continue trying if error is "Unsupported model"
Browse files Browse the repository at this point in the history
Fixes #314
  • Loading branch information
xenova committed Mar 11, 2024
1 parent c55d0f0 commit d8b318d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/pipelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -3019,7 +3019,7 @@ export async function pipeline(
cache_dir = null,
local_files_only = false,
revision = 'main',
device= null,
device = null,
session_options = {},
} = {}
) {
Expand Down Expand Up @@ -3105,7 +3105,15 @@ async function loadItems(mapping, model, pretrainedOptions) {
resolve(await c.from_pretrained(model, pretrainedOptions));
return;
} catch (err) {
e = err;
if (err.message?.includes('Unsupported model type')) {
// If the error is due to an unsupported model type, we
// save the error and try the next class.
e = err;
} else {
reject(err);
return;
}

}
}
reject(e);
Expand Down

0 comments on commit d8b318d

Please sign in to comment.