NER output from amazon sagemaker endpoint

0

I have successfully deployed sagemaker endpoint for huggingface NER model https://huggingface.co/Universal-NER/UniNER-7B-all

Now as I'm trying to use it.

import boto3
import json
ENDPOINT_NAME = "ner-2023-09-14-11-39-34"
runtime= boto3.client('runtime.sagemaker')
payload = {"inputs": "My name is Wolfgang and I live in Berlin"}
body_data = json.dumps(payload).encode('utf-8')
response = runtime.invoke_endpoint(EndpointName=ENDPOINT_NAME,
                                       ContentType='application/json',
                                       Body=body_data)
result = json.loads(response['Body'].read().decode())
print(result)
[{'generated_text': 'My name is Wolfgang and I live in Berlin. I am 27 years old and I am a student. I am studying at the University'}

]

As you can see the generated_text just completes the sentence. I was expecting the NER model will identify the person and place in the input text. Is there any way to get the expected output ? like Wolfgang = Person, Berlin = Place

munna
demandé il y a 8 mois55 vues
Aucune réponse

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions