【报错】HuggingFace Transformers connection issue

有时候跑hugging face的代码,莫名其妙地会报下面这个错误:

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

有人说,删除cache文件就行;有人说from_pretrain的时候指定local_file或者force_download等参数;也有人说是http proxy的问题;还有人说重启机器就能解决…

笔者曾不止一次遇到过该问题,每次遇到这个问题,都是试了上述各种方法,一开始不奏效,最后莫名其妙地就解决了(我什么也没做)…

笔者得出结论:主要是因为报错信息太抽象了,导致这个connection error的原因有很多,上述提到的每一种都有可能,建议每一种都去尝试一下…有时候不妨出去撒泡尿,回来可能就恢复正常了也不一定。。

参考:

  • https://github.com/huggingface/transformers/issues/8690
  • https://github.com/huggingface/transformers/issues/10067

你可能感兴趣的:(各类报错,深度学习,pytorch)