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

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

Open
1 task done
neowalter opened this issue Feb 1, 2024 · 1 comment

Comments

@neowalter
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

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

@neowalter neowalter changed the title [BUG/Help] <title> [BUG/Help] ImportError: cannot import name 'default_hp_search_backend' from 'transformers.integrations' Feb 1, 2024
@SimonLeeGit
Copy link

SimonLeeGit commented Feb 5, 2024

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

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