mlfoundations / open_clip

An open source implementation of CLIP.
Other
9.29k stars 923 forks source link

safetensors support when loading from hf_hub #820

Open deniz-birlikci opened 5 months ago

deniz-birlikci commented 5 months ago

Changes

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.