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
asked 7 months ago52 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions