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회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인