Closed awaelchli closed 6 months ago
Yeah, I think we originally added it for mistral and only few others need it (like Gemma).
I wonder if we should make --safetensors true
the new default for the new user experience. It's actually safer :). And if a safetensor format is not available, we throw a warning and say "download the model with --safetensors false`. What do you think?
There should be a way to check are there any files in the repo with .safetensors
extension.
Here is what I found after a quick search. Maybe there is an easier way exists.
from huggingface_hub import HfFileSystem
fs = HfFileSystem()
repo_id = "google/gemma-2b"
filenames = [x["name"] for x in fs.ls(repo_id)]
print(filenames)
outputs:
['google/gemma-2b/.gitattributes',
'google/gemma-2b/README.md',
'google/gemma-2b/config.json',
'google/gemma-2b/gemma-2b.gguf',
'google/gemma-2b/generation_config.json',
'google/gemma-2b/model-00001-of-00002.safetensors',
'google/gemma-2b/model-00002-of-00002.safetensors',
'google/gemma-2b/model.safetensors.index.json',
'google/gemma-2b/special_tokens_map.json',
'google/gemma-2b/tokenizer.json',
'google/gemma-2b/tokenizer.model',
'google/gemma-2b/tokenizer_config.json']
This looks reasonable to me. We already import from huggingface_hub
so that wouldn't add an additional dependency
If you forget to set
--from_safetensors True
when downloading models, you get:We assume that users perfectly follow the download tutorial guides where
--from_safetensors True
for some commands. But intuitively, I feel like the download scripts could probably choose this automatically. Some need it, some don't.