I attempted to run your simple example from the project readme file, and it generated an error during the pipeline processing.
import spacy
from spacycake import BertKeyphraseExtraction as bake
nlp = spacy.load('en')
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) # <-- List of 3 keyphrases
Generated the error:
RuntimeError Traceback (most recent call last)
<ipython-input-3-a85540c14de5> in <module>
----> 1 doc = nlp("This is a test but obviously you need to place a bigger document here to extract meaningful keyphrases")
2 print(doc._.extracted_phrases) # <-- List of 3 keyphrases
/anaconda2/envs/hr-analysis/lib/python3.8/site-packages/spacy/language.py in __call__(self, text, disable, component_cfg)
447 if not hasattr(proc, "__call__"):
448 raise ValueError(Errors.E003.format(component=type(proc), name=name))
--> 449 doc = proc(doc, **component_cfg.get(name, {}))
450 if doc is None:
451 raise ValueError(Errors.E005.format(name=name))
/anaconda2/envs/hr-analysis/lib/python3.8/site-packages/spacycake/__init__.py in __call__(self, doc)
103 while len(R) > 0:
104 first_part = torch.matmul(doc_embedding, phrases_embeddings[R].transpose(0, 1))
--> 105 second_part = torch.matmul(
106 phrases_embeddings[R],
107 phrases_embeddings[S].transpose(0, 1)).max(dim=1).values
RuntimeError: cannot perform reduction function max on tensor with no elements because the operation does not have an identity
I attempted to run your simple example from the project readme file, and it generated an error during the pipeline processing.
Generated the error:
This is the Python environment:
Running python 3.8.5 spaCy 2.3.2 spacybert 1.0.1 spacycaKE 1.0.0