SpacyBert/SpacyCake 无法对张量执行归约函数 max
SpacyBert/SpacyCake cannot perform reduction function max on tensor
我已经安装了 SpacyBert 和 SpacyCake 来从文本语料库中提取关键词短语。我检查了所有依赖项并安装了所有内容,但出现以下错误。有什么想法吗?
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)
我认为您使用的型号有误。该模型用于其他目的。
Huggingface transformer 模型是预训练的"bert-base-uncased"
您使用的型号有误。
pip install spacy
python -m spacy download en_trf_bertbaseuncased_lg
我已经安装了 SpacyBert 和 SpacyCake 来从文本语料库中提取关键词短语。我检查了所有依赖项并安装了所有内容,但出现以下错误。有什么想法吗?
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)
我认为您使用的型号有误。该模型用于其他目的。
Huggingface transformer 模型是预训练的"bert-base-uncased"
您使用的型号有误。
pip install spacy
python -m spacy download en_trf_bertbaseuncased_lg