I am using the following code
!pip install datasets transformers[sentencepiece]
from transformers import pipeline
ner = pipeline("ner", grouped_entities=True, model='dbmdz/bert-large-cased-finetuned-conll03-english') #Named Entity Recognition (NER)
ner("My name is <Name> and I work at <Office> in <location>.")
And I got the following warning. How to improve upon this warning?
UserWarning:
grouped_entities
is deprecated and will be removed in version v5.0.0, defaulted toaggregation_strategy="AggregationStrategy.SIMPLE"
instead.
According to [HuggingFace]: Pipelines - class transformers.TokenClassificationPipeline (emphasis is mine):
bool
, optional, defaults to False) - DEPRECATED, use aggregation_strategy
instead. Whether or not to group the tokens corresponding to the same entity together in the predictions or not.So, your line of code could be:
ner = pipeline("ner", aggregation_strategy="simple", model="dbmdz/bert-large-cased-finetuned-conll03-english") # Named Entity Recognition (NER)