mindspore-lab / mindnlp

Easy-to-use and high-performance NLP and LLM framework based on MindSpore, compatible with models and datasets of 🤗Huggingface.
https://mindnlp.cqu.ai/
Apache License 2.0
686 stars 189 forks source link

AutoModelForCausalLM加载CodeLlama-7b-Instruct-hf报错 #1518

Closed xuhangscut closed 2 months ago

xuhangscut commented 2 months ago

Describe the bug/ 问题描述 (Mandatory / 必填) A clear and concise description of what the bug is. 通过mindnlp.transformers.AutoModelForCausalLM加载AI-ModelScope/CodeLlama-7b-Instruct-hf模型时,报错safetensors_rust.SafetensorError: Error while deserializing header: HeaderTooLarge,且已经pip install --upgrade safetensor更新至最新版本

To Reproduce / 重现步骤 (Mandatory / 必填) model_name = "AI-ModelScope/CodeLlama-7b-Instruct-hf" tokenizer = CodeLlamaTokenizer.from_pretrained(model_name, mirror="modelscope") model = AutoModelForCausalLM.from_pretrained(model_name, mirror="modelscope")

Expected behavior / 预期结果 (Mandatory / 必填) A clear and concise description of what you expected to happen.

Screenshots/ 日志 / 截图 (Mandatory / 必填)

Building prefix dict from the default dictionary ... Loading model from cache /tmp/jieba.cache Loading model cost 0.616 seconds. Prefix dict has been built successfully. Loading checkpoint shards: 0%| | 0/2 [00:00<?, ?it/s] Traceback (most recent call last): File "/data1/xuhang/5009_nl2sql/nl2sql_finetuning_ms.py", line 168, in model = AutoModelForCausalLM.from_pretrained(model_name, mirror="modelscope") File "/data1/xuhang/envs/nl2sql/lib/python3.9/site-packages/mindnlp/transformers/models/auto/auto_factory.py", line 509, in from_pretrained return model_class.from_pretrained( File "/data1/xuhang/envs/nl2sql/lib/python3.9/site-packages/mindnlp/transformers/modeling_utils.py", line 2911, in from_pretrained ) = cls._load_pretrained_model( File "/data1/xuhang/envs/nl2sql/lib/python3.9/site-packages/mindnlp/transformers/modeling_utils.py", line 3266, in _load_pretrained_model state_dict = load_state_dict(shard_file, is_quantized=is_quantized) File "/data1/xuhang/envs/nl2sql/lib/python3.9/site-packages/mindnlp/transformers/modeling_utils.py", line 435, in load_state_dict with safe_open(checkpoint_file, framework="np") as f: safetensors_rust.SafetensorError: Error while deserializing header: HeaderTooLarge

Additional context / 备注 (Optional / 选填)

lvyufeng commented 2 months ago

应该是你文件下载的有问题,重新下载试试,我这边没这个问题