SafetensorError: Error while deserializing header: MetadataIncompleteBuffer
#2
by
cc-01
- opened
执行
import torch
from transformers import LlamaForCausalLM, LlamaTokenizer
model_name_or_path = "XuanYuan-70B"
tokenizer = LlamaTokenizer.from_pretrained(model_name_or_path, use_fast=False, legacy=True)
model = LlamaForCausalLM.from_pretrained(model_name_or_path, torch_dtype=torch.bfloat16,device_map="auto")
model.eval()
inputs = tokenizer("问题:李时珍是哪一个朝代的人?回答:", return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=64, repetition_penalty=1.1)
outputs = tokenizer.decode(outputs.cpu()[0][len(inputs.input_ids[0]):], skip_special_tokens=True)
print(outputs)
报错。
环境信息:
pytorch 2.1.1
python 3.9
你好,该问题可能是模型权重未下载完整导致。 请检查下每个safetensors文件的sha256sum值,是否与huggingface 上一致。 如不一致,需要重新下载
thanks
cc-01
changed discussion status to
closed