You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
System info isn't super relevant here since the confusion is really just an just an error message string. I just reproduced in a CPU instance but this is applicable whenever model loading is needed.
transformers version: 4.40.1
Platform: Linux-6.1.58+-x86_64-with-glibc2.35
Python version: 3.10.12
Huggingface_hub version: 0.22.2
Safetensors version: 0.4.3
Accelerate version: 0.29.3
Accelerate config: not found
PyTorch version (GPU?): 2.2.1+cu121 (False)
Tensorflow version (GPU?): 2.15.0 (False)
Flax version (CPU?/GPU?/TPU?): 0.8.2 (cpu)
Jax version: 0.4.26
JaxLib version: 0.4.26
Using GPU in script?: No
Using distributed or parallel set-up in script?: No
Who can help?
Not sure who most recently worked on modeling_util.py or model loading parts. Please feel free to point me to the right person
Information
The official example scripts
My own modified scripts
Tasks
An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
My own task or dataset (give details below)
Reproduction
Setup has safetensors library installed
fromtransformersimportAutoTokenizer, AutoModelForCausalLM# this is just a cloned example GPTQ quant model. # The point of this is that this repo contains a `gptq_model-4bit-128g.safetensors` file (default naming by AutoGPTQ library), but not `model.safetensors`.# Not having a `.safetensors` and/or any modeling files produces the same behavior# Note how use_safetensors is not passed in# With safetensors library, it will default to `use_safetensors=None` inside `.from_pretrained()` functiontokenizer=AutoTokenizer.from_pretrained("davidxmle/Llama-3-8B-Instruct-GPTQ-4-Bit-Debug")
model=AutoModelForCausalLM.from_pretrained("davidxmle/Llama-3-8B-Instruct-GPTQ-4-Bit-Debug")
An error will get thrown
davidxmle/Llama-3-8B-Instruct-GPTQ-4-Bit-Debug does not appear to have a file named pytorch_model.bin, tf_model.h5, model.ckpt or flax_model.msgpack.
Error message has no mention of .safetensors file is an accepted model file format.
Expected behavior
This isn't necessarily a bug but rather a confusing error message. I initially noticed this issue when I uploaded a GPTQ quant model made using the AutoGPTQ library to huggingface but some folks reported that they are getting the error above does not appear to have a file named pytorch_model.bin, tf_model.h5, model.ckpt or flax_model.msgpack. One would have immediately assumed safetensors is not an accepted file format and I must not use safetensors but rather use one of the models listed above, since I do have a safetensors file in the repo.
Upon further investigation I realized that the use_safetensors is an optional argument to be passed in added in #22083. This means use_safetensors can either be False if explicitly defined as False or does not have safetensors package installed, True if explicitly defined as so, or, most importantly use_safetensors will default toNone if not specified but has safetensors installed.
The pull request added in #22083, does add an error message specifically for safe tensors, but it uses elif use_safetensors: for the error message specific for safetensors, and used elif use_safetensors is not False elsewhere... elif use_safetensors: evaluates both the default case with None value and explict False case to false, so the error message containing safetensors in the default case never reached there. I do believe this is the expected behavior since we do not want to only mention safetensors is missing in the default case.
However, in the case where the use_safetensors is defaulted to None when the arg is not passed in and model file is missing, there is no mention of .safetensors is supported. This should be comprehensive list of all modeling files that are supported, including model.safetensors.
I have put together a super simple PR and changed the unit test to address this.
The text was updated successfully, but these errors were encountered:
System Info
System info isn't super relevant here since the confusion is really just an just an error message string. I just reproduced in a CPU instance but this is applicable whenever model loading is needed.
transformers
version: 4.40.1Who can help?
Not sure who most recently worked on
modeling_util.py
or model loading parts. Please feel free to point me to the right personInformation
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Setup has safetensors library installed
An error will get thrown
Error message has no mention of
.safetensors
file is an accepted model file format.Expected behavior
This isn't necessarily a bug but rather a confusing error message. I initially noticed this issue when I uploaded a GPTQ quant model made using the AutoGPTQ library to huggingface but some folks reported that they are getting the error above
does not appear to have a file named pytorch_model.bin, tf_model.h5, model.ckpt or flax_model.msgpack.
One would have immediately assumedsafetensors
is not an accepted file format and I must not usesafetensors
but rather use one of the models listed above, since I do have asafetensors
file in the repo.Upon further investigation I realized that the
use_safetensors
is an optional argument to be passed in added in #22083. This meansuse_safetensors
can either beFalse
if explicitly defined asFalse
or does not have safetensors package installed,True
if explicitly defined as so, or, most importantlyuse_safetensors
will default toNone
if not specified but has safetensors installed.The pull request added in #22083, does add an error message specifically for safe tensors, but it uses
elif use_safetensors:
for the error message specific for safetensors, and usedelif use_safetensors is not False
elsewhere...elif use_safetensors:
evaluates both the default case withNone
value and explictFalse
case to false, so the error message containing safetensors in the default case never reached there. I do believe this is the expected behavior since we do not want to only mention safetensors is missing in the default case.However, in the case where the
use_safetensors
is defaulted toNone
when the arg is not passed in and model file is missing, there is no mention of.safetensors
is supported. This should be comprehensive list of all modeling files that are supported, includingmodel.safetensors
.I have put together a super simple PR and changed the unit test to address this.
The text was updated successfully, but these errors were encountered: