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

Add safeglobals to allow metaclip models to load with weights_only=True #967

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

rwightman
Copy link
Collaborator

No description provided.

…ue, add bigG metaclip while working with them
@rwightman rwightman merged commit cd15a7b into main Oct 21, 2024
4 checks passed
@rwightman rwightman deleted the weights_only_fix branch October 21, 2024 19:41
import numpy as np
# add safe globals, known to be needed for metaclip weights
torch.serialization.add_safe_globals([
_codecs.encode, # now in pytorch main but some pytorch versions w/ weights_only flag don't have it
Copy link
Contributor

Choose a reason for hiding this comment

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

What if you specify that's not necessary from PyTorch 2.5.0 (I checked this)?

Copy link
Contributor

Choose a reason for hiding this comment

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

For accountability, this is how I checked it's in that release (tag): I opened pytorch/pytorch@1e9bedf, and saw that it contains the tag v2.5.0 (meaning that this commit is included in the tag, thus the release).

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.

2 participants