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

[Help]试图修改模型下载位置,报错does not appear to have a file named config.json

Open yumehatoh opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

首次配置,执行python web_demo.py之前,参照https://github.com/THUDM/ChatGLM-6B/issues/50#issuecomment-1469862918修改模型下载位置:

path = "/home/3090-server/personal/bsc/ChatGLM/ChatGLM-6B/models" tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True) model = AutoModel.from_pretrained(path, trust_remote_code=True).half().cuda()

原代码:

tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True) model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().cuda()

报错:

Traceback (most recent call last): File "/home/3090-server/personal/bsc/ChatGLM/ChatGLM-6B/web_demo.py", line 5, in tokenizer = AutoTokenizer.from_pretrained(mypath, trust_remote_code=True) File "/opt/miniconda3/envs/chatglm/lib/python3.10/site-packages/transformers/models/auto/tokenization_auto.py", line 613, in from_pretrained config = AutoConfig.from_pretrained( File "/opt/miniconda3/envs/chatglm/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 852, in from_pretrained config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs) File "/opt/miniconda3/envs/chatglm/lib/python3.10/site-packages/transformers/configuration_utils.py", line 565, in get_config_dict config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs) File "/opt/miniconda3/envs/chatglm/lib/python3.10/site-packages/transformers/configuration_utils.py", line 620, in _get_config_dict resolved_config_file = cached_file( File "/opt/miniconda3/envs/chatglm/lib/python3.10/site-packages/transformers/utils/hub.py", line 380, in cached_file raise EnvironmentError( OSError: /home/3090-server/personal/bsc/ChatGLM/ChatGLM-6B/models does not appear to have a file named config.json. Checkout 'https://huggingface.co//home/3090-server/personal/bsc/ChatGLM/ChatGLM-6B/models/None' for available files.

如果不修改就可以正常运行。是不是必须先用默认的位置执行一遍,再手动修改?

Expected Behavior

No response

Steps To Reproduce

No.

Environment

- OS:Ubuntu 18.04
- Python:3.10
- Transformers:4.26.1
- PyTorch:1.13.1+cu117
- CUDA Support:True

Anything else?

No response

yumehatoh avatar Mar 16 '23 17:03 yumehatoh

日志里说/home/3090-server/personal/bsc/ChatGLM/ChatGLM-6B/models目录下没有config.json

可以尝试把Hugging Face的仓库clone下来,并在代码中指向仓库所在的目录,确保目录下有config.json

evshiron avatar Mar 16 '23 18:03 evshiron

日志里说/home/3090-server/personal/bsc/ChatGLM/ChatGLM-6B/models目录下没有config.json

可以尝试把Hugging Face的仓库clone下来,并在代码中指向仓库所在的目录,确保目录下有config.json

解决了,谢谢

yumehatoh avatar Mar 17 '23 08:03 yumehatoh

你好,请问你是怎么解决的呢,我的也碰到了这种错误:

Traceback (most recent call last): File "web_demo.py", line 7, in tokenizer = AutoTokenizer.from_pretrained("/Users/hezhiheng/Documents/LEARN/AI/ChatCLM_Test/ChatGLM-6B/model", trust_remote_code=True) File "/Users/hezhiheng/opt/anaconda3/envs/ChatCLM-Test/lib/python3.8/site-packages/transformers/models/auto/tokenization_auto.py", line 634, in from_pretrained config = AutoConfig.from_pretrained( File "/Users/hezhiheng/opt/anaconda3/envs/ChatCLM-Test/lib/python3.8/site-packages/transformers/models/auto/configuration_auto.py", line 896, in from_pretrained config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs) File "/Users/hezhiheng/opt/anaconda3/envs/ChatCLM-Test/lib/python3.8/site-packages/transformers/configuration_utils.py", line 573, in get_config_dict config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs) File "/Users/hezhiheng/opt/anaconda3/envs/ChatCLM-Test/lib/python3.8/site-packages/transformers/configuration_utils.py", line 628, in _get_config_dict resolved_config_file = cached_file( File "/Users/hezhiheng/opt/anaconda3/envs/ChatCLM-Test/lib/python3.8/site-packages/transformers/utils/hub.py", line 380, in cached_file raise EnvironmentError( OSError: /Users/hezhiheng/Documents/LEARN/AI/ChatCLM_Test/ChatGLM-6B/model does not appear to have a file named config.json. Checkout 'https://huggingface.co//Users/hezhiheng/Documents/LEARN/AI/ChatCLM_Test/ChatGLM-6B/model/None' for available files.

mr2hzh avatar Jul 31 '23 02:07 mr2hzh

有可能是传入模型路径的时候,传入的是github下载的程序目录,而不是huggingface下载的模型目录

zhangxuan602461121 avatar Aug 31 '23 06:08 zhangxuan602461121

你好,请问如何解决的 我也是第一次配置的时候,在执行demo.py时报错: File "/data/zhangxueyi/jmx/ChatGLM2-6B/web_demo.py", line 6, in model = AutoModel.from_pretrained("chatglm2-6b", trust_remote_code=True).cuda() File "/data/zhangxueyi/miniconda3/envs/llama_10/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 456, in from_pretrained config, kwargs = AutoConfig.from_pretrained( File "/data/zhangxueyi/miniconda3/envs/llama_10/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 944, in from_pretrained config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs) File "/data/zhangxueyi/miniconda3/envs/llama_10/lib/python3.10/site-packages/transformers/configuration_utils.py", line 574, in get_config_dict config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs) File "/data/zhangxueyi/miniconda3/envs/llama_10/lib/python3.10/site-packages/transformers/configuration_utils.py", line 629, in _get_config_dict resolved_config_file = cached_file( File "/data/zhangxueyi/miniconda3/envs/llama_10/lib/python3.10/site-packages/transformers/utils/hub.py", line 388, in cached_file raise EnvironmentError( OSError: chatglm2-6b does not appear to have a file named config.json. Checkout 'https://huggingface.co/chatglm2-6b/None' for available files. 但是我路径已经改好了,而且config.json是在正确位置的,全部东西都是从hf下载下来上传到服务器的

pushanshan2 avatar Sep 02 '23 14:09 pushanshan2

日志里说/home/3090-server/personal/bsc/ChatGLM/ChatGLM-6B/models目录下没有config.json

可以尝试把Hugging Face的仓库clone下来,并在代码中指向仓库所在的目录,确保目录下有config.json。 你好,请问怎么在代码中指向仓库所在的目录哇

pushanshan2 avatar Sep 02 '23 14:09 pushanshan2