Kaggle 代码不下载“gpt2”语言模型

问题描述 投票:0回答:1

我正在使用kaggle代码下载gpt2语言模型。

from transformers import AutoTokenizer, AutoModelForCausalLM

device = "cuda" if torch.cuda.is_available() else "cpu"
model_name = "gpt2-xl"
tokenizer = AutoTokenizer.from_pretrained(model_name)

打算从huggingface hub下载gpt2-xl模型。 但最后一行引发了 LocalEntryNotFoundError。 详情如下。

LocalEntryNotFoundError Traceback(最后一次调用)

/opt/conda/lib/python3.7/site-packages/transformers/utils/hub.py 中的缓存文件(路径或回购 ID、文件名、缓存目录、强制下载、恢复下载、代理、use_auth_token、修订版、local_files_only、子文件夹、user_agent、_raise_exceptions_for_missing_entries, _raise_exceptions_for_connection_errors,_commit_hash) 攀上漂亮女局长之后419 --> 420 local_files_only=local_files_only, 421 )

OSError:我们无法连接到“https://huggingface.co”来加载这个文件,在缓存文件中找不到它,看起来 gpt2-xl 不是包含名为的文件的目录的路径配置.json.

检查您的互联网连接或查看如何在“https://huggingface.co/docs/transformers/installation#offline-mode”中以离线模式运行库。

kaggle 代码似乎没有连接到 huggingface hub。 为什么会发生这种情况,我该如何解决这个错误?

python huggingface-transformers kaggle gpt-2
1个回答
0
投票

kaggle 无法下载 resnet50 预训练模型

这个真的很有帮助。 我用我的电话号码验证,然后连接到互联网。

© www.soinside.com 2019 - 2024. All rights reserved.