根据huggingface document

要么启动命令行上加上标志,要么python加载时候带上local_files_only=True

命令行:

HF_DATASETS_OFFLINE=1 HF_HUB_OFFLINE=1 \
python examples/pytorch/translation/run_translation.py --model_name_or_path google-t5/t5-small --dataset_name wmt16 --dataset_config ro-en ...

python

from transformers import T5Model

model = T5Model.from_pretrained("./path/to/local/directory", local_files_only=True)

模型在国内可以通过huggingface mirror下载。https://hf-mirror.com/。

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐