model = AutoModel.from_pretrained("chatglm-6b", trust_remote_code=True).half().cuda()
model = AutoModel.from_pretrained(model_path, trust_remote_code=True, from_tf=True).half().cuda()
model = model.float()
model = model.eval()
response, history = model.chat(tokenizer, "你好", history=[])
print(response)
出现以下错误
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.
Explicitly passing a revision is encouraged when loading a configuration with custom code to ensure no malicious code has been contributed in a newer revision.
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 "API_test.py", line 7, in
model = str(AutoModel.from_pretrained(model_path, trust_remote_code=True, local_files_only=True, from_tf=True).half().cuda())
File "/home/linluocheng086/.local/lib/python3.7/site-packages/transformers/models/auto/auto_factory.py", line 467, in from_pretrained
pretrained_model_name_or_path, *model_args, config=config, hub_kwargs, kwargs
File "/home/linluocheng086/.local/lib/python3.7/site-packages/transformers/modeling_utils.py", line 2604, in from_pretrained
if resolved_archive_file.endswith(".index"):
AttributeError: 'list' object has no attribute 'endswith'
Expected Behavior
No response
Steps To Reproduce
在使用调用api时候
from transformers import AutoTokenizer, AutoModel
model = AutoModel.from_pretrained("chatglm-6b", trust_remote_code=True).half().cuda()
model = AutoModel.from_pretrained(model_path, trust_remote_code=True, from_tf=True).half().cuda()
model = model.float()
model = model.eval()
response, history = model.chat(tokenizer, "你好", history=[])
print(response)
出现以下错误
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.
Explicitly passing a revision is encouraged when loading a configuration with custom code to ensure no malicious code has been contributed in a newer revision.
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 "API_test.py", line 7, in
model = str(AutoModel.from_pretrained(model_path, trust_remote_code=True, local_files_only=True, from_tf=True).half().cuda())
File "/home/linluocheng086/.local/lib/python3.7/site-packages/transformers/models/auto/auto_factory.py", line 467, in from_pretrained
pretrained_model_name_or_path, *model_args, config=config, hub_kwargs, kwargs
File "/home/linluocheng086/.local/lib/python3.7/site-packages/transformers/modeling_utils.py", line 2604, in from_pretrained
if resolved_archive_file.endswith(".index"):
AttributeError: 'list' object has no attribute 'endswith'
Environment
- OS:mac os
- Python:3.7
- Transformers:4.27.1
- PyTorch: 1.13.1
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) :
Is there an existing issue for this?
Current Behavior
在使用调用api时候 from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True,revision="main")
model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half()
model_path = "chatglm-6b" tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = AutoModel.from_pretrained("chatglm-6b", trust_remote_code=True).half().cuda()
model = AutoModel.from_pretrained(model_path, trust_remote_code=True, from_tf=True).half().cuda() model = model.float() model = model.eval() response, history = model.chat(tokenizer, "你好", history=[]) print(response) 出现以下错误 Explicitly passing a
model = str(AutoModel.from_pretrained(model_path, trust_remote_code=True, local_files_only=True, from_tf=True).half().cuda())
File "/home/linluocheng086/.local/lib/python3.7/site-packages/transformers/models/auto/auto_factory.py", line 467, in from_pretrained
pretrained_model_name_or_path, *model_args, config=config, hub_kwargs, kwargs
File "/home/linluocheng086/.local/lib/python3.7/site-packages/transformers/modeling_utils.py", line 2604, in from_pretrained
if resolved_archive_file.endswith(".index"):
AttributeError: 'list' object has no attribute 'endswith'
revision
is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision. Explicitly passing arevision
is encouraged when loading a configuration with custom code to ensure no malicious code has been contributed in a newer revision. Explicitly passing arevision
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 "API_test.py", line 7, inExpected Behavior
No response
Steps To Reproduce
在使用调用api时候 from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True,revision="main")
model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half()
model_path = "chatglm-6b" tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = AutoModel.from_pretrained("chatglm-6b", trust_remote_code=True).half().cuda()
model = AutoModel.from_pretrained(model_path, trust_remote_code=True, from_tf=True).half().cuda() model = model.float() model = model.eval() response, history = model.chat(tokenizer, "你好", history=[]) print(response) 出现以下错误 Explicitly passing a
model = str(AutoModel.from_pretrained(model_path, trust_remote_code=True, local_files_only=True, from_tf=True).half().cuda())
File "/home/linluocheng086/.local/lib/python3.7/site-packages/transformers/models/auto/auto_factory.py", line 467, in from_pretrained
pretrained_model_name_or_path, *model_args, config=config, hub_kwargs, kwargs
File "/home/linluocheng086/.local/lib/python3.7/site-packages/transformers/modeling_utils.py", line 2604, in from_pretrained
if resolved_archive_file.endswith(".index"):
AttributeError: 'list' object has no attribute 'endswith'
revision
is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision. Explicitly passing arevision
is encouraged when loading a configuration with custom code to ensure no malicious code has been contributed in a newer revision. Explicitly passing arevision
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 "API_test.py", line 7, inEnvironment
Anything else?
No response