无法导入 Hugging Face 变形金刚

Unable to import Hugging Face transformers

直到今天我一直在使用变形金刚。然而,当我今天导入包时,我收到了这个错误信息:

In Transformers v4.0.0, the default path to cache downloaded models changed from '~/.cache/torch/transformers' to '~/.cache/huggingface/transformers'. Since you don't seem to have overridden and '~/.cache/torch/transformers' is a directory that exists, we're moving it to '~/.cache/huggingface/transformers' to avoid redownloading models you have already in the cache. You should only see this message once.

Error: Destination path '/home/user/.cache/huggingface/transformers/transformers' already exists

我已经尝试安装和卸载软件包,但仍然无法正常工作。

如有任何解决此问题的建议,我们将不胜感激。

因为它似乎是一个缓存文件,只需将 /huggingface/ 目录移动到 /huggingface.bak

那么你应该可以重新运行脚本。

感谢 Joshua,上述问题已通过以下命令解决:

  mv ~/.cache/huggingface/transformers ~/.cache/huggingface-tmp