调用transformer模型出现connection erro

2023-11-28  本文已影响0人  辘轳鹿鹿
ValueError: Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet connection is on.

问题分析:可能是网络不好,无法通过代码下载transform

解决办法

from transformers import AutoModel, AutoTokenizer

model_path = "./models/your_model_directory"  # 替换为模型文件夹路径
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModel.from_pretrained(model_path)

上一篇下一篇

猜你喜欢

热点阅读