最近在训练句子相关性时出现的问题,运行时出现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-chinese is not the path to a directory containing a file named config.json. Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.
主要是因为huggingface.co在中国境内大部分都无法访问了
解决方法也很简单
注意一定要在你使用transformers之前引入这个镜像网站
import os os.environ["HF_ENDPOINT"] = "https://hf-mirror.com"