THUDM / ChatGLM-6B

ChatGLM-6B: An Open Bilingual Dialogue Language Model | 开源双语对话语言模型
Apache License 2.0
39.96k stars 5.15k forks source link

[BUG/Help] ImportError: cannot import name 'default_hp_search_backend' from 'transformers.integrations' #1453

Open neowalter opened 5 months ago

neowalter commented 5 months ago

Is there an existing issue for this?

Current Behavior

Traceback (most recent call last): File "/content/ChatGLM-6B/ptuning/main.py", line 43, in from trainer_seq2seq import Seq2SeqTrainer File "/content/ChatGLM-6B/ptuning/trainer_seq2seq.py", line 22, in from trainer import Trainer File "/content/ChatGLM-6B/ptuning/trainer.py", line 41, in from transformers.integrations import ( ImportError: cannot import name 'default_hp_search_backend' from 'transformers.integrations' (/usr/local/lib/python3.10/dist-packages/transformers/integrations/init.py)

Expected Behavior

the code should work properly and the package should load smoothly.

Steps To Reproduce

when run this command in the Colab download the repo with the following script import git repo = git.Repo.clone_from("https://github.com/THUDM/ChatGLM-6B.git", "ChatGLM-6B") change the cwd with %cd /content/ChatGLM-6B/ptuning then run the command !bash /content/ChatGLM-6B/ptuning/train.sh

Environment

- OS:Google Colab T4
- Python: 3.10.12
- Transformers:4.37.2
- PyTorch:https://download.pytorch.org/whl/cu121/torch-2.1.0%2Bcu121-cp310-cp310-linux_x86_64.whl#sha256=0d4e8c52a1fcf5ed6cfc256d9a370fcf4360958fc79d0b08a51d55e70914df46
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) :True

Anything else?

didn't find the solution from the transfomers repo

SimonLeeGit commented 5 months ago

I have the same error~~

You must use transformers with 4.27.1 @neowalter , I've checked, it works. you maybe need to install the below libs first before running the train.sh

pip install cpm_kernels sentencepiece