-
Notifications
You must be signed in to change notification settings - Fork 25
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
default Model.onnx_model to target onnx.model.tar.gz #355
Conversation
This change fixes failing test `tests/sparsezoo/objects/test_directory.py ...F....`
…creation Add model.onnx.tar.gz to expected files Update test_unzipping to force unzip, as the parent directory is already present
src/sparsezoo/objects/directories.py
Outdated
@@ -280,16 +280,17 @@ class OnnxGz(Directory): | |||
""" | |||
Special class to handle onnx.model.tar.gz files. | |||
Desired behavior is that all information about files included in the tarball are | |||
available however, when the file.path is accessed, it will point only to the | |||
`model.onnx` as this is the expected behavior for loading, additionally, | |||
available however, when the file's `path` property is accessed, it will point only |
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.
annoying, but apostrophes '
are not well supported by Sphinx, they tend to parse these as unclosed strings
src/sparsezoo/model/model.py
Outdated
files, directory_class=OnnxGz, display_name="model.onnx.tar.gz" | ||
) | ||
self.onnx_model: File = ( | ||
self._file_from_files(files, display_name="model.onnx.") |
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.
should this be "model.onnx" instead of "model.onnx." ?
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.
good catch
minor updates post approval, merging |
currently, sparsezoo does not have great support for onnx models saved with external data out of the box. especially for user friendly and deepsparse compatible flows such as
Model.onnx_model.path
.Better support will be added in a future backend update - to fix this now, this PR updates the default target for
Model.onnx_model
to be themodel.onnx.tar.gz
where possible. A helper class is added to enforce that when a user tries to access the onnx model path, the compressed model is downloaded and unzipped and the reference to the model path points only to the extractedmodel.onnx
file where applicablenote - any users who have already tried to download models with external data will need to clear them from cache
test_plan:
Manually verified with both an external model and a legacy model (see below) - would be good to add these as unit tests, however the download times for the external models can take a while as they are >2Gb. Existing functionality should be thoroughly covered in sparsezoo, deepsparse, and sparseml testing