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] <title>ModuleNotFoundError: No module named 'transformers_modules.' #475

Closed
1 task done
Song367 opened this issue Apr 9, 2023 · 2 comments
Closed
1 task done

Comments

@Song367
Copy link

Song367 commented Apr 9, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Explicitly passing a revision is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Traceback (most recent call last):
File "D:\workplace\CHATGLM\ChatGLM-6B\tt.py", line 2, in
tokenizer = AutoTokenizer.from_pretrained("../bb-model", trust_remote_code=True)
File "D:\python\lib\site-packages\transformers\models\auto\tokenization_auto.py", line 663, in from_pretrained
tokenizer_class = get_class_from_dynamic_module(
File "D:\python\lib\site-packages\transformers\dynamic_module_utils.py", line 399, in get_class_from_dynamic_module
return get_class_in_module(class_name, final_module.replace(".py", ""))
File "D:\python\lib\site-packages\transformers\dynamic_module_utils.py", line 177, in get_class_in_module
module = importlib.import_module(module_path)
File "D:\python\lib\importlib_init_.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 972, in _find_and_load_unlocked
File "", line 228, in _call_with_frames_removed
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 972, in _find_and_load_unlocked
File "", line 228, in _call_with_frames_removed
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 972, in _find_and_load_unlocked
File "", line 228, in _call_with_frames_removed
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'transformers_modules.'

Expected Behavior

No response

Steps To Reproduce

运行了文件

from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("../bb-model", trust_remote_code=True)
model = AutoModel.from_pretrained("../bb-model", trust_remote_code=True).float()
response, history = model.chat(tokenizer, "你好", history=[])
print(response)

Environment

- OS: win11
- Python: 3.9
- Transformers: 4.27.1 
- PyTorch: 2.0.0
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) :

Anything else?

No response

@Song367
Copy link
Author

Song367 commented Apr 9, 2023

cuda support : False

@duzx16
Copy link
Member

duzx16 commented Apr 9, 2023

Duplicate of #310

@duzx16 duzx16 marked this as a duplicate of #310 Apr 9, 2023
@duzx16 duzx16 closed this as completed Apr 9, 2023
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