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

safetensors support when loading from hf_hub #820

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

deniz-birlikci
Copy link

Changes

  • requirements file includes safetensors import
  • load_checkpoint function now loads safetensors if there's .safetensors suffix
  • download_pretrained_from_hf function checks for .bin file first, and if that isn't found, checks for .safetensors file

Why is this important?
With safetensors being much faster in loading up the weights, this is a helpful change for the repository. These modifications only come into effect if the HF repository does not have the .bin file, therefore, there would be no changes to the current open_clip users. My changes only come into effect if the .bin file is missing, and instead of raising an Exception, it checks the repo again for .safetensors file before doing so.

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.

None yet

1 participant