Skip to content
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

ValueError: The model class you are passing has a config_class attribute that is not consistent with the config class you passed (model has None and you passed <class 'transformers_modules.codefuse-ai.CodeFuse-CGE-Small.fd0871aa546be63188628752a09c4d42dd07250d.configuration_codefuse_cge_small.CodeFuseCGESmallConfig'>. Fix one of those so they match! #3

Open
CZH-THU opened this issue Nov 22, 2024 · 9 comments

Comments

@CZH-THU
Copy link

CZH-THU commented Nov 22, 2024

ValueError when use transformers==4.43.0 to load "codefuse-ai/CodeFuse-CGE-Small"

ValueError: The model class you are passing has a config_class attribute that is not consistent with the config class you passed (model has None and you passed <class 'transformers_modules.codefuse-ai.CodeFuse-CGE-Small.fd0871aa546be63188628752a09c4d42dd07250d.configuration_codefuse_cge_small.CodeFuseCGESmallConfig'>. Fix one of those so they match!

@CZH-THU
Copy link
Author

CZH-THU commented Nov 22, 2024

ImportError when use transformers==4.39.2 to load "codefuse-ai/CodeFuse-CGE-Small"
ImportError: cannot import name 'Phi3ForCausalLM' from 'transformers' (/home/*****/codefuse/lib/python3.11/site-packages/transformers/init.py)

@feather820
Copy link
Collaborator

Hi,I can't reproduce this error when I using transformers==4.43,but I can reproduce this error when I using transformers==4.46,so can you post your python environment using pip list here?

@CZH-THU
Copy link
Author

CZH-THU commented Nov 25, 2024

Hi,I can't reproduce this error when I using transformers==4.43,but I can reproduce this error when I using transformers==4.46,so can you post your python environment using pip list here?

accelerate 0.28.0
annotated-types 0.7.0
asttokens 2.4.1
certifi 2024.8.30
charset-normalizer 3.4.0
comm 0.2.2
debugpy 1.8.9
decorator 5.1.1
deepspeed 0.15.4
executing 2.1.0
filelock 3.16.1
fsspec 2024.10.0
hjson 3.1.0
huggingface-hub 0.26.2
idna 3.10
ipykernel 6.29.5
ipython 8.29.0
jedi 0.19.2
Jinja2 3.1.4
jupyter_client 8.6.3
jupyter_core 5.7.2
MarkupSafe 3.0.2
matplotlib-inline 0.1.7
mpmath 1.3.0
msgpack 1.1.0
nest-asyncio 1.6.0
networkx 3.4.2
ninja 1.11.1.1
numpy 2.1.3
nvidia-cublas-cu12 12.1.3.1
nvidia-cuda-cupti-cu12 12.1.105
nvidia-cuda-nvrtc-cu12 12.1.105
nvidia-cuda-runtime-cu12 12.1.105
nvidia-cudnn-cu12 8.9.2.26
nvidia-cufft-cu12 11.0.2.54
nvidia-curand-cu12 10.3.2.106
nvidia-cusolver-cu12 11.4.5.107
nvidia-cusparse-cu12 12.1.0.106
nvidia-nccl-cu12 2.18.1
nvidia-nvjitlink-cu12 12.6.85
nvidia-nvtx-cu12 12.1.105
packaging 24.2
parso 0.8.4
peft 0.13.2
pexpect 4.9.0
pip 24.2
platformdirs 4.3.6
prompt_toolkit 3.0.48
psutil 6.1.0
ptyprocess 0.7.0
pure_eval 0.2.3
py-cpuinfo 9.0.0
pydantic 2.10.1
pydantic_core 2.27.1
Pygments 2.18.0
python-dateutil 2.9.0.post0
PyYAML 6.0.2
pyzmq 26.2.0
regex 2024.11.6
requests 2.32.3
safetensors 0.4.5
setuptools 75.2.0
six 1.16.0
stack-data 0.6.3
sympy 1.13.3
tokenizers 0.19.1
torch 2.1.0
tornado 6.4.2
tqdm 4.67.0
traitlets 5.14.3
transformers 4.43.0
triton 2.1.0
typing_extensions 4.12.2
urllib3 2.2.3
wcwidth 0.2.13
wheel 0.44.0

@feather820
Copy link
Collaborator

Sorry for the late reply. I have set up your environment, but I still can't reproduce the bug. The code runs normally in the environment you provided.
Xnip2024-12-09_15-34-45
Xnip2024-12-09_15-34-31

@feather820
Copy link
Collaborator

Could you please install the following packages in a new Python environment and try again?
accelerate==0.28.0 annotated-types==0.7.0 asttokens==2.4.1 certifi==2024.8.30 charset-normalizer==3.4.0 comm==0.2.2 debugpy==1.8.9 decorator==5.1.1 deepspeed==0.15.4 executing==2.1.0 filelock==3.16.1 fsspec==2024.10.0 hjson==3.1.0 huggingface-hub==0.26.2 idna==3.10 ipykernel==6.29.5 ipython==8.29.0 jedi==0.19.2 Jinja2==3.1.4 jupyter_client==8.6.3 jupyter_core==5.7.2 MarkupSafe==3.0.2 matplotlib-inline==0.1.7 mpmath==1.3.0 msgpack==1.1.0 nest-asyncio==1.6.0 networkx==3.4.2 ninja==1.11.1.1 numpy==2.1.3 nvidia-cublas-cu12==12.1.3.1 nvidia-cuda-cupti-cu12==12.1.105 nvidia-cuda-nvrtc-cu12==12.1.105 nvidia-cuda-runtime-cu12==12.1.105 nvidia-cudnn-cu12==8.9.2.26 nvidia-cufft-cu12==11.0.2.54 nvidia-curand-cu12==10.3.2.106 nvidia-cusolver-cu12==11.4.5.107 nvidia-cusparse-cu12==12.1.0.106 nvidia-nccl-cu12==2.18.1 nvidia-nvjitlink-cu12==12.6.85 nvidia-nvtx-cu12==12.1.105 packaging==24.2 parso==0.8.4 peft==0.13.2 pexpect==4.9.0 pip==24.2 platformdirs==4.3.6 prompt_toolkit==3.0.48 psutil==6.1.0 ptyprocess==0.7.0 pure_eval==0.2.3 py-cpuinfo==9.0.0 pydantic==2.10.1 pydantic_core==2.27.1 Pygments==2.18.0 python-dateutil==2.9.0.post0 PyYAML==6.0.2 pyzmq==26.2.0 regex==2024.11.6 requests==2.32.3 safetensors==0.4.5 setuptools==75.2.0 six==1.16.0 stack-data==0.6.3 sympy==1.13.3 tokenizers==0.19.1 torch==2.1.0 tornado==6.4.2 tqdm==4.67.0 traitlets==5.14.3 transformers==4.43.0 triton==2.1.0 typing_extensions==4.12.2 urllib3==2.2.3 wcwidth==0.2.13 wheel==0.44.0

@CZH-THU
Copy link
Author

CZH-THU commented Dec 10, 2024

Could you please install the following packages in a new Python environment and try again? accelerate==0.28.0 annotated-types==0.7.0 asttokens==2.4.1 certifi==2024.8.30 charset-normalizer==3.4.0 comm==0.2.2 debugpy==1.8.9 decorator==5.1.1 deepspeed==0.15.4 executing==2.1.0 filelock==3.16.1 fsspec==2024.10.0 hjson==3.1.0 huggingface-hub==0.26.2 idna==3.10 ipykernel==6.29.5 ipython==8.29.0 jedi==0.19.2 Jinja2==3.1.4 jupyter_client==8.6.3 jupyter_core==5.7.2 MarkupSafe==3.0.2 matplotlib-inline==0.1.7 mpmath==1.3.0 msgpack==1.1.0 nest-asyncio==1.6.0 networkx==3.4.2 ninja==1.11.1.1 numpy==2.1.3 nvidia-cublas-cu12==12.1.3.1 nvidia-cuda-cupti-cu12==12.1.105 nvidia-cuda-nvrtc-cu12==12.1.105 nvidia-cuda-runtime-cu12==12.1.105 nvidia-cudnn-cu12==8.9.2.26 nvidia-cufft-cu12==11.0.2.54 nvidia-curand-cu12==10.3.2.106 nvidia-cusolver-cu12==11.4.5.107 nvidia-cusparse-cu12==12.1.0.106 nvidia-nccl-cu12==2.18.1 nvidia-nvjitlink-cu12==12.6.85 nvidia-nvtx-cu12==12.1.105 packaging==24.2 parso==0.8.4 peft==0.13.2 pexpect==4.9.0 pip==24.2 platformdirs==4.3.6 prompt_toolkit==3.0.48 psutil==6.1.0 ptyprocess==0.7.0 pure_eval==0.2.3 py-cpuinfo==9.0.0 pydantic==2.10.1 pydantic_core==2.27.1 Pygments==2.18.0 python-dateutil==2.9.0.post0 PyYAML==6.0.2 pyzmq==26.2.0 regex==2024.11.6 requests==2.32.3 safetensors==0.4.5 setuptools==75.2.0 six==1.16.0 stack-data==0.6.3 sympy==1.13.3 tokenizers==0.19.1 torch==2.1.0 tornado==6.4.2 tqdm==4.67.0 traitlets==5.14.3 transformers==4.43.0 triton==2.1.0 typing_extensions==4.12.2 urllib3==2.2.3 wcwidth==0.2.13 wheel==0.44.0

I have tried the python environment but still fail,and I try transformers==4.47.0 but still fail with with the same error,maybe the error is not matter with the version of transformers
55de2f193f2e8b723e73afdfbd2d7b9

@feather820
Copy link
Collaborator

In my case, everything works fine when I'm using the Python environment. While searching for the bug online, I came across this discussion: https://huggingface.co/zhihan1996/DNABERT-2-117M/discussions/6. Could you try loading the configuration first?

@CZH-THU
Copy link
Author

CZH-THU commented Dec 24, 2024

Seemly the model can't be loaded automatically,so I fix it by downloading the model files manually.

@feather820
Copy link
Collaborator

We apologize for the inconvenience caused during your use. We were unaware that you were not loading it through a download, which is why we couldn't reproduce the error. Thank you very much for using our service and helping us identify this bug. We have updated modeling.py to resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants