最后运行出现的错误如下
D:\live2d+chatgpt\4.19\ChatGLM-6B>python web_demo.py
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 "web_demo.py", line 5, in
tokenizer = AutoTokenizer.from_pretrained("./chatglm-6b", trust_remote_code=True)
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\models\auto\tokenization_auto.py", line 664, in from_pretrained
pretrained_model_name_or_path, module_file + ".py", class_name, **kwargs
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\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 "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\dynamic_module_utils.py", line 165, in get_class_in_module
subprocess.run(["python", "-c", cmd])
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\site-packages\run__init.py", line 145, in new
process = cls.create_process(command, stdin, cwd=cwd, env=env, shell=shell)
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\site-packages\run__init__.py", line 121, in create_process
shlex.split(command),
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\shlex.py", line 310, in split
return list(lex)
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\shlex.py", line 299, in next__
token = self.get_token()
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\shlex.py", line 109, in get_token
raw = self.read_token()
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\shlex.py", line 140, in read_token
nextchar = self.instream.read(1)
AttributeError: 'list' object has no attribute 'read'
Expected Behavior
No response
Steps To Reproduce
无
Environment
- OS:
- Python:3.8
- Transformers:4.26.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
安装pip install -r requirements.txt 并把huggingface的chatglm-6b文件直接放在根目录下的chatglm-6b文件夹下,并把web_demo和cli_demo中 "THUDM/chatglm-6b "替换成了如下代码
tokenizer = AutoTokenizer.from_pretrained("./chatglm-6b", trust_remote_code=True) model = AutoModel.from_pretrained("./chatglm-6b", trust_remote_code=True).half().cuda() model = model.eval()
但是没有更改chatglm-6b文件夹里面的任何文件 比如config里面的
{ "_name_or_path": "THUDM/chatglm-6b", "architectures": [ "ChatGLMModel"
和tokenizer_config里面的
"name_or_path": "THUDM/chatglm-6b",
最后运行出现的错误如下 D:\live2d+chatgpt\4.19\ChatGLM-6B>python web_demo.py Explicitly passing a
tokenizer = AutoTokenizer.from_pretrained("./chatglm-6b", trust_remote_code=True)
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\models\auto\tokenization_auto.py", line 664, in from_pretrained
pretrained_model_name_or_path, module_file + ".py", class_name, **kwargs
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\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 "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\dynamic_module_utils.py", line 165, in get_class_in_module
subprocess.run(["python", "-c", cmd])
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\site-packages\run__init.py", line 145, in new
process = cls.create_process(command, stdin, cwd=cwd, env=env, shell=shell)
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\site-packages\run__init__.py", line 121, in create_process
shlex.split(command),
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\shlex.py", line 310, in split
return list(lex)
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\shlex.py", line 299, in next__
token = self.get_token()
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\shlex.py", line 109, in get_token
raw = self.read_token()
File "C:\Users\ZS\AppData\Local\Programs\Python\Python37\lib\shlex.py", line 140, in read_token
nextchar = self.instream.read(1)
AttributeError: 'list' object has no attribute 'read'
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 "web_demo.py", line 5, inExpected Behavior
No response
Steps To Reproduce
无
Environment
Anything else?
No response