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

fix: Address PyTorch Model Loading Deprecation Warning (GH-30) #37

Merged
merged 3 commits into from
Nov 11, 2024

Conversation

mbsantiago
Copy link
Collaborator

This PR addresses the PyTorch deprecation warning related to loading models without explicitly setting the only_weights parameter (#30). This warning stems from a security concern with using the pickle library for loading model objects, as it can potentially execute arbitrary code.

While this is unlikely to be an issue with the model shipped with this package, it could pose a risk when loading custom models or if unexpected behavior arises in future versions.

To mitigate this:

  • Set only_weights=True as the default when loading the model. This loads only the model weights and avoids potential security risks associated with unpickling.
  • Added a test to verify that loading the model with only_weights=True does not affect its behavior. This test compares the loaded parameters and predictions between the two loading methods across various audio inputs.

Our tests confirm that using only_weights=True does not alter the model's functionality, allowing us to safely address the deprecation warning and enhance security.

Thanks to @revilodarnoc for filing the issue!

@mbsantiago mbsantiago merged commit 4627ddd into main Nov 11, 2024
4 checks passed
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.

Where and how to change for setting torch.load with weights_only=False
1 participant