在加载权重的过程中出现报错
OSError: Unable to load weights from pytorch checkpoint file for 'checkpoints/llama-7b_hf/pytorch_model-00001-of-00002.bin' at 'checkpoints/llama-7b_hf/pytorch_model-00001-of-00002.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True
比然是权重文件损坏了,此时可以先使用代码进行验证
import torch
# 尝试加载单个文件
file_path = "权重文件路径"
try:
state_dict = torch.load(file_path)
print("File loaded successfully.")
except Exception as e:
print(f"Failed to load the file: {e}")
如果能够File loaded successfully,说明文件没问题,如果依然报错如题,则需要重新下载权重文件