`"transformers_version"` is not enforced
See original GitHub issueSystem Info
transformers
version: 4.21.1- Platform: macOS-10.16-x86_64-i386-64bit
- Python version: 3.9.7
- Huggingface_hub version: 0.8.1
- PyTorch version (GPU?): 1.9.1 (False)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: Yes+no
- Using distributed or parallel set-up in script?: no
Who can help?
This is a general problem with loading pretrained models in the library, not any specific model: @sgugger @stevhliu @patrickvonplaten
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
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("NinedayWang/PolyCoder-2.7B")
model = AutoModelForCausalLM.from_pretrained("NinedayWang/PolyCoder-2.7B")
Expected behavior
The model’s config.json
specifies that this model requires version 4.23.1
here:
https://huggingface.co/NinedayWang/PolyCoder-2.7B/blob/main/config.json#L21
but if the user is trying to load this model with an older version (4.21.1
), it still incorrectly and silently does load.
So, I would expect an error instead of a successful loading, because with an old version of transformers
, this model produces incorrect predictions.
I prefer not being able to load the checkpoint if I don’t have the required version of the library.
In other words, why do we have the "transformers_version"
field in the config.json
, if it is not enforced?
Thanks!
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Ah, yet another argument for not adding config arguments like those. Thanks for pointing that out.
Thanks a lot!