Skip to content

Commit

Permalink
Fix model file download
Browse files Browse the repository at this point in the history
  • Loading branch information
hans00 authored Jun 18, 2024
1 parent 9f30f1b commit 9109355
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/utils/hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -884,18 +884,16 @@ export async function getModelPath(path_or_repo_id, filename, fatal = true, opti
file: filename
}

if (response === undefined) {
const cachePath = path.join(options.cache_dir ?? env.cacheDir, proposedCacheKey);
await downloadFile(remoteURL, cachePath, data => {
dispatchCallback(options.progress_callback, {
...progressInfo,
...data,
})
});
response = await getFile(cachePath);
if (response.status !== 200) {
return handleError(response.status, remoteURL, fatal);
}
const cachePath = path.join(options.cache_dir ?? env.cacheDir, proposedCacheKey);
await downloadFile(remoteURL, cachePath, data => {
dispatchCallback(options.progress_callback, {
...progressInfo,
...data,
})
});
response = await getFile(cachePath);
if (response.status !== 200) {
return handleError(response.status, remoteURL, fatal);
}

dispatchCallback(options.progress_callback, {
Expand Down

0 comments on commit 9109355

Please sign in to comment.