Skip to content
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

PyTorch Zipfile Check and Tests #87

Merged
merged 4 commits into from
Jan 19, 2024
Merged

PyTorch Zipfile Check and Tests #87

merged 4 commits into from
Jan 19, 2024

Conversation

swashko
Copy link
Collaborator

@swashko swashko commented Jan 19, 2024

  • Adds a check to PyTorchUnsafeOpScan against being a zipfile, since PyTorch's newer format (after 1.6) saves as a zip that can be unzipped to get a pickle file, but if PyTorchUnsafeOpScan gets a zipfile, it will fail due to Magic Number mismatch
  • Intended behavior for new format PyTorch files is to unzip and scan the pickle with PickleUnsafeOpScan
  • Adds tests for safe old and new format PyTorch files and unsafe new format
  • Updated Pytorch tests #18 to just need an old format unsafe file test, since our current PickleInject is not working with the old format
  • Closes Invalid magic number for pytorch model scan #82

@swashko swashko self-assigned this Jan 19, 2024
@swashko swashko mentioned this pull request Jan 19, 2024
Copy link
Member

@seanpmorgan seanpmorgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

@seanpmorgan seanpmorgan merged commit ee254ab into main Jan 19, 2024
8 checks passed
@seanpmorgan seanpmorgan deleted the 82-magic-num branch January 19, 2024 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid magic number for pytorch model scan
2 participants