问题
I want to use "grouped_entities" in the huggingface pipeline for ner task. However having issues doing that.
I do look the following link on git but this did not help: https://github.com/huggingface/transformers/pull/4987
回答1:
I got the answer its very straight forward in the transformer v4.0.0. Previously I was using older version of transformer package. example:
from transformers import AutoTokenizer,
AutoModelForTokenClassification,TokenClassificationPipeline
from transformers import pipeline
tokenizer = AutoTokenizer.from_pretrained("fine_tune_model_path")
model = AutoModelForTokenClassification.from_pretrained("fine_tune_model_path")
nlp=pipeline(task='ner',model=model,
tokenizer=tokenizer,grouped_entities=True)
来源:https://stackoverflow.com/questions/65353104/i-want-to-use-grouped-entities-in-the-huggingface-pipeline-for-ner-task-how-t