-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
Bug using revision param in AutoModelForCausalLM.from_pretrained #23745
Comments
cc @sgugger who is more familiar with this, I won't have bandwidth to dive into this now. |
The revision argument is supported for weights but not for the code at the moment. Support will be added soon, but in the meantime you can download the revision for this repo and then use |
Nice thanks you @sgugger ! |
@sgugger isn't this a security issue? When using |
@samhavens This comes from the recent change we made to avoid duplicating the code files in all repos (now there is one source of truth). As I said we're working on a fix, should come tomorrow/early next week. |
If you want to give it a try, the PR linked above should fix your issue. |
Thanks @sgugger! |
System Info
2023-05-24 23:09:53.575434: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
WARNING:tensorflow:From /usr/local/lib/python3.10/dist-packages/transformers/commands/env.py:63: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use
tf.config.list_physical_devices('GPU')
instead.2023-05-24 23:10:05.261610: W tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc:47] Overriding orig_value setting because the TF_FORCE_GPU_ALLOW_GROWTH environment variable is set. Original config value was 0.
Copy-and-paste the text below in your GitHub issue and FILL OUT the two last points.
transformers
version: 4.29.2Who can help?
@ArthurZucker
@younesbelkada
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
I was trying to use the new shiny mpt model from the huggingface hub from a revision :
But I stumble on this error after the using the above code :
ValueError: MPTForCausalLM does not support
device_map='auto'yet.
The "auto" was indeed not supported in the main branch but we add a correction in the PR branch (so the argument revision="refs/pr/23")
I did some investigation and the model was indeed loading the main .py files :
You can see the main/ here. I did manually check the modeling_mpt.py file it didn't have the PR changes.
So I did try to find where the bug where inside the transformers package ... (first time looking at the code).
I am a bit surprised !
Basicly the code rewrite the config values after having read it (it adds the information about the repo ids (in add_model_info_to_auto_map in generic.py in utils/ from the transformers package) something that seems normal.
It notably add the "--" string.
then in get_class_from_dynamic_module (in dynamic_module_utils.py) it has :
So the revision become "main" and from here we are done.
I suppose if i do a PR removing the revision overide some people will not be happy ?
Expected behavior
The expected behaviour is to load the file from the PR branch. (not the main/)
The text was updated successfully, but these errors were encountered: