【问题标题】:SpacyBert/SpacyCake cannot perform reduction function max on tensor [closed]SpacyBert/SpacyCake 无法对张量执行最大缩减函数 [关闭]
【发布时间】:2021-02-24 06:19:45
【问题描述】:

我安装了 SpacyBertSpacyCake 来从文本语料库中提取关键字词组。我检查了所有依赖项并安装了所有内容,但出现以下错误。有什么想法吗?

File "/usr/local/lib/python3.8/site-packages/spacy/language.py", line 449, in __call__ doc = proc(doc, **component_cfg.get(name, {})) File "/usr/local/lib/python3.8/site-packages/spacycake/__init__.py", line 105, in __call__ second_part = torch.matmul( RuntimeError: cannot perform reduction function max on tensor with no elements because the operation does not have an identity

我下载了正确的语言模型,所以不确定是什么导致了问题。我测试过的模型:

nlp = spacy.load("en_core_web_md") and
nlp = spacy.load("en")

Spacy 工作正常,因为我可以执行其他 NLP 任务,但只是在我尝试使用时:

cake = bake(nlp, from_pretrained='bert-base-cased', top_k=3)
nlp.add_pipe(cake, last=True)

doc = nlp("This is a test but obviously you need to place a bigger document here to extract meaningful keyphrases")
print(doc._.extracted_phrases)

【问题讨论】:

  • 请详细说明您使用或下载的语言模型?因为有几种语言模型,就我到目前为止的测试而言,spacy 运行良好。
  • 这里你使用了错误的模型。我想,如果我错了,请纠正我。
  • 根据 pip install 说明我不是。 pypi.org/project/spacycake 我已经分别检查了 'en' 和 en_core_web_md。

标签: python spacy huggingface-transformers


【解决方案1】:

我认为您使用了错误的模型。该模型用于其他目的。 Huggingface Transformer 模型经过预训练"bert-base-uncased"

这里你使用了错误的模型。

See this

pip install spacy
python -m spacy download en_trf_bertbaseuncased_lg

【讨论】:

  • 谢谢。现在正在下载。我会告诉你进展如何。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-03-15
  • 2022-01-28
相关资源
最近更新 更多