I try to set up a german ner, pretrained with bert via the huggingface pipeline. For some texts the following code throws an error "RuntimeError: The size of tensor a (921) must match the size of tensor b (512) at non-singleton dimension 1" for the line "ner = classifier(text)".
I already did some research with stackoverflow and this is the most similar problem i found:The size of tensor a (707) must match the size of tensor b (512) at non-singleton dimension 1
The solution sounds good, I just don't know where i can specify those settings while using the huggingface pipeline. What do I need to change in my code to make it work properly?
thanks!
from transformers import pipeline
classifier = pipeline('ner', model="fhswf/bert_de_ner", grouped_entities=True)
text = (dic[pi].text)
ner = classifier(text)