赞
踩
一般来说这类都是访问不了huggingface导致的,我遇到具体问题描述如下
OSError: We couldn't connect to 'https://huggingface.co' to load this file,
couldn't find it in the cached files
and it looks like bert-base-uncased is not the path to a directory containing a file named config.json.
可以提供通过将资源下载到本地解决,这里我通过huggingface镜像站下载的方式解决
pip install -U huggingface_hub
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download --resume-download --local-dir-use-symlinks False bert-base-uncased --local-dir bert-base-uncased
由于每个人遇到的资源问题不一致,一版都是 tokenizer 的问题,而且报错是都会有堆栈信息,大家稍加细心便能发现问题
#model = AutoModelWithHeads.from_pretrained("bert-base-uncased")
model = AutoModelWithHeads.from_pretrained("资源本地路径", local_files_only=True)
#tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
tokenizer = AutoTokenizer.from_pretrained("资源本地路径", local_files_only=True)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。