WisdomShell / codeshell

A series of code large language models developed by PKU-KCL
http://se.pku.edu.cn/kcl
Other
1.61k stars 119 forks source link

报错Can't load the configuration of WisdomShell--CodeShell-7B-Chat\config.json #60

Closed big-F closed 9 months ago

big-F commented 9 months ago

我是直接在huggingface上把文件下到本地了。下的是这里的文件 https://huggingface.co/WisdomShell/CodeShell-7B-Chat/tree/main

然后我在web_demo.py做了修改 def _load_model_tokenizer(args): tokenizer = AutoTokenizer.from_pretrained(

args.checkpoint_path, trust_remote_code=True, resume_download=True,

    'D:\\models\\WisdomShell--CodeShell-7B-Chat',
)

model = AutoModelForCausalLM.from_pretrained(
    # args.checkpoint_path,
    'D:\\models\\WisdomShell--CodeShell-7B-Chat',
    device_map=args.device,
    trust_remote_code=True,
    resume_download=True,
    torch_dtype=torch.bfloat16,
).eval()

config = GenerationConfig.from_pretrained(
    # args.checkpoint_path, trust_remote_code=True, resume_download=True,
    'D:\\models\\WisdomShell--CodeShell-7B-Chat\\config.json',
)

运行报错 OSError: Can't load the configuration of 'D:\models\WisdomShell--CodeShell-7B-Chat\config.json'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'D:\models\WisdomShell--CodeShell-7B-Chat\config.json' is the correct path to a directory containing a generation_config.json file

我看config.json里的"_name_or_path": "/nvme/xr/checkpoints/codeshell/pt_codeshell/iter_0023208/hf",是这样的 请问我该如何解决,谢谢

big-F commented 9 months ago

config = GenerationConfig.from_pretrained(

args.checkpoint_path, trust_remote_code=True, resume_download=True,

'D:\\models\\WisdomShell--CodeShell-7B-Chat',

这样就可以运行了。 https://huggingface.co/docs/transformers/installation误导了我