【下载预训练模型失败】OSError: Consistency check failed: file should be of size xxx but has size xxx

慈云数据 2024-03-13 技术支持 273 0

问题描述

这个错误表明在下载预训练模型文件pytorch_model.bin时出现了一致性检查失败。下载的文件大小与期望的文件大小不一致。

【下载预训练模型失败】OSError: Consistency check failed: file should be of size xxx but has size xxx
(图片来源网络,侵删)

解决方法

如果在使用***,那就先关闭代理

代码中加上force_download=True和resume_download=False参数,强制重新下载模型文件并禁用断点续传。

【下载预训练模型失败】OSError: Consistency check failed: file should be of size xxx but has size xxx
(图片来源网络,侵删)

示例:

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("csebuetnlp/mT5_multilingual_XLSum", force_download=True, resume_download=False)
model = AutoModelForSeq2SeqLM.from_pretrained("csebuetnlp/mT5_multilingual_XLSum", force_download=True, resume_download=False)

如果问题仍然存在,检查网络,最重要的一点:关闭代理!!!

微信扫一扫加客服

微信扫一扫加客服

点击启动AI问答
Draggable Icon