-
Notifications
You must be signed in to change notification settings - Fork 287
Add missing match
on onnx/model.onnx
download
#472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing match
on onnx/model.onnx
download
#472
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I trust that it's fine if you checked it. Worse case we patch.
I'm surprised at the logic flow though.
Prevents the logging message "Model ONNX weights downloaded in ..." from showing whenever those are either not present or not downloaded
You're right indeed, there's something that I missed because the |
let p = api.get("onnx/model.onnx").await?; | ||
model_files.push(p.parent().unwrap().to_path_buf()) | ||
|
||
match api.get("onnx/model.onnx").await { | ||
Ok(p) => model_files.push(p.parent().unwrap().to_path_buf()), | ||
Err(err) => tracing::warn!("Could not download `onnx/model.onnx`: {err}"), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this virtually the same? How is the error handled in this fn?
.await | ||
.map_err(|err| BackendError::WeightsNotFound(err.to_string())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't you only need to add a ?
after the map_err
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No because it still succeeds as far as I remember the download_onnx
function was not producing errors but just warnings so empty ONNX files was not considered an error and so on it was printing that the files where there while those really weren't + this doesn't need to fail as it needs to fallback to the Safetensors backend if the ONNX files are not there.
Anyway I could've missed something, so please let me know!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What does this PR do?
This PR adds a missing
match
statement within thedownload_onnx
function as it was missing for theonnx/model.onnx
download, leading to an unexpected logging message claiming that the ONNX files were downloaded successfully, while those were not indeed (see attachment at huggingface/Google-Cloud-Containers#132 (comment)).This PR fixes a non-breaking issue, as even if the logging messages were misleading the behaviour for rolling back to
safetensors
if ONNX weights were not available is working as expected.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@OlivierDehaene