Error invoking inference endpoint

The model i’ve used to deploy is

I’ve also tried downloading spanmarker

import requests

url = “GitHub - tomaarsen/SpanMarkerNER: SpanMarker for Named Entity Recognition
response = requests.get(url)
with open(“requirements.txt”, “wb”) as f:
f.write(response.content)

and putting it into a “model creation”

hub = {
‘HF_MODEL_ID’:‘tomaarsen/span-marker-roberta-large-ontonotes5’,
‘HF_TASK’:‘span-marker’
}

huggingface_model = HuggingFaceModel(
transformers_version = ‘4.28.1’,
pytorch_version=‘2.0.0’,
py_version=‘py310’,
role=‘arn:aws:iam::026588382219:role/service-role/AmazonSageMaker-ExecutionRole-20230920T145199’,
env=hub,
dependencies=[‘requirements.txt’]
)

Spanmaker models are not supported by default you would need to write a custom inference.py script.

Can you provide any content for creating a custom container image? Thanks

Here is an example for sentence transformers you can follow the same steps Creating document embeddings with Hugging Face's Transformers & Amazon SageMaker

1 Like