Deploy named entity recogintion model to sagemaker grouping

Hi all,

I’m currently trying to deploy one of the HuggingFace models into sagemaker, specifically

Blockquote “hub”: {
“HF_MODEL_ID”:“Jean-Baptiste/roberta-large-ner-english”,
“HF_TASK”:“token-classification”
}

with a docker image uri

Blockquote

“docker_image_uri”:“763104351884.dkr.ecr.eu-west-2.amazonaws.com/huggingface-pytorch-inference:1.9.0-transformers4.10.2-gpu-py38-cu111-ubuntu20.04”,

The deployment works successfully. However, when I try to get some results, they don’t seem to properly group the results together.

For example, when I use

Blockquote nlp_jean_baptiste = pipeline(‘ner’, model=jean_model, tokenizer=jean_tokenizer, aggregation_strategy=“simple”)

Blockquote nlp_jean_baptiste("Great food, great staff, great Italian atmosphere! Gimmi made amazing our dinner. Can’t wait to come back ")

The above yields

Blockquote {‘entity_group’: ‘PER’,
‘score’: 0.998259,
‘word’: ’ Gimmi’,
‘start’: 51,
‘end’: 56}]

However, on AWS, the result is
{‘entity’: ‘PER’,
‘score’: 0.9982286691665649,
‘index’: 11,
‘word’: ‘ĠG’,
‘start’: 51,
‘end’: 52},
{‘entity’: ‘PER’,
‘score’: 0.9983111023902893,
‘index’: 12,
‘word’: ‘imm’,
‘start’: 52,
‘end’: 55},
{‘entity’: ‘PER’,
‘score’: 0.9982370734214783,
‘index’: 13,
‘word’: ‘i’,
‘start’: 55,
‘end’: 56}]

Using the aggregation_strategy doesn’t yield any results when I use it as a parameter with the inputs. I’m currently wondering if there is a way to properly use the aggregation_strategy or another way to properly group the results or is there another strategy that I can use to properly group the results together.

Nvm, I just had to update to a more recent version of transformers

1 Like