关于报错
self.tokenizer = CamembertTokenizer.from_pretrained(“camembert-base”)
resolved_vocab_files[file_id] = cached_path(
output_path = get_from_cache(
raise ValueError(
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.
解决:
运行时候 命令行输入
TRANSFORMERS_OFFLINE=1 python test.py
sh文件则是
TRANSFORMERS_OFFLINE=1 \ python test.py
在运行代码时候
参考官网: 报错原因:
Firewalled environments
Some cloud and intranet setups have their GPU instances firewalled to the outside world, so if your script is trying to download model weights or datasets it will first hang and then timeout with an error message like:
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.
One possible solution in this situation is to use the “offline-mode”.
解决办法:Offline mode
It’s possible to run 🤗 Transformers in a firewalled or a no-network environment.
Setting environment variable TRANSFORMERS_OFFLINE=1 will tell 🤗 Transformers to use local files only and will not try to look things up.
Most likely you may want to couple this with HF_DATASETS_OFFLINE=1 that performs the same for 🤗 Datasets if you’re using the latter.