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
已提问 8 个月前55 查看次数
没有答案

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则