ChatGLM-6B icon indicating copy to clipboard operation
ChatGLM-6B copied to clipboard

[BUG/Help] <title>AttributeError: module transformers has no attribute TFChatGLMForConditionalGeneration

Open lelechallc opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

更改web_demo.py为: tokenizer = AutoTokenizer.from_pretrained("chatglm-6b_pre", trust_remote_code=True,from_tf=True) model = AutoModel.from_pretrained("chatglm-6b_pre", trust_remote_code=True,from_tf=True).half().cuda()

运行web_demo.py时候出现Traceback (most recent call last): File "/home/jovyan/web_demo.py", line 6, in model = AutoModel.from_pretrained("chatglm-6b_pre", trust_remote_code=True,from_tf=True).half().cuda() File "/home/linluocheng086/miniconda3/envs/chatglm/lib/python3.9/site-packages/transformers/models/auto/auto_factory.py", line 466, in from_pretrained return model_class.from_pretrained( File "/home/linluocheng086/miniconda3/envs/chatglm/lib/python3.9/site-packages/transformers/modeling_utils.py", line 2612, in from_pretrained model, loading_info = load_tf2_checkpoint_in_pytorch_model( File "/home/linluocheng086/miniconda3/envs/chatglm/lib/python3.9/site-packages/transformers/modeling_tf_pytorch_utils.py", line 407, in load_tf2_checkpoint_in_pytorch_model tf_model_class = getattr(transformers, tf_model_class_name) File "/home/linluocheng086/miniconda3/envs/chatglm/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 1119, in getattr raise AttributeError(f"module {self.name} has no attribute {name}") AttributeError: module transformers has no attribute TFChatGLMForConditionalGeneration 的问题。如何解决??

Expected Behavior

No response

Steps To Reproduce

Environment

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

Anything else?

no

lelechallc avatar Apr 17 '23 06:04 lelechallc

你确定 chatglm-6b_pre 里面的文件是完整的吗,对比 https://huggingface.co/THUDM/chatglm-6b

duzx16 avatar Apr 18 '23 02:04 duzx16