BrainEditor 2024-05-13 11:50 采纳率: 20%
浏览 65

hugging-face 模型无法安装

我在运行 https://github.com/liyucheng09/MetaphorFrame 上的相关代码时候出现了问题。
按照作者本人提示安装了相关dependdencies, (部分软件下载不到,就用了最新版本替代)然后再 运行

python inference.py example_articles.json

(

base) C:\Users\Administrator>activate metaframe

(metaframe) C:\Users\Administrator>cd MetaphorFrame

(metaframe) C:\Users\Administrator\MetaphorFrame>python inference.py example_articles.json
的时候
得到的反馈是 无法连接到‘hugging-face
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 CreativeLang/metaphor_detection_roberta_seq 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'.
事实上,我t通过代理,可以连接到 hugging face.

我以为是应为无法直接安装其中的 CreativeLang/metaphor_detection_roberta_seq ,又再 hf 上找到了 它,
https://51.159.194.235/CreativeLang/metaphor_detection_roberta_seq/tree/main?__cpo=aHR0cHM6Ly9odWdnaW5nZmFjZS5jbw
按照readme 提示运行

python inference.py CreativeLang/metaphor_detection_roberta_seq

得到的结果是

(metaframe) C:\Users\Administrator\MetaphorFrame>python inference.py CreativeLang/metaphor_detection_roberta_seq
Traceback (most recent call last):
File "C:\Users\Administrator\MetaphorFrame\inference.py", line 112, in
assert os.path.exists(input_file), f'Input file {input_file} does not exist.'
^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Input file CreativeLang/metaphor_detection_roberta_seq does not exist.

(metaframe) C:\Users\Administrator\MetaphorFrame>
请教各位专家,到底是哪里出现了问题,应该如何改正?

另外,如果我将CreativeLang/metaphor_detection_roberta_seq 下的文件全部下载,又将如何修改相关代码或者路径,能给出具体代码为佳。

  • 写回答

2条回答 默认 最新

  • 专家-皆知 2024-05-13 11:50
    关注

    尝试使用虚拟环境安装,或者检查网络连接和包仓库配置。

    以上回复有部分引自免费微信小程序:皆我百晓生。 如问题尚未解决,还请稍待,如有疑问请回复进一步沟通。

    评论

报告相同问题?

问题事件

  • 创建了问题 5月13日