Thank you for the pointer @philschmid. In that PR, I noticed that some containers for version 4.17.0
have already been released as mentioned here: Release v1.0-hf-4.17.0-pt-1.10.2-py38 路 aws/deep-learning-containers 路 GitHub
This nearly made my day I tried to use one of these images and run inference on it for ASR using a simple wav file like this:
from sagemaker.huggingface import HuggingFaceModel
import sagemaker
role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
'HF_MODEL_ID':'facebook/wav2vec2-xlsr-53-espeak-cv-ft',
'HF_TASK':'automatic-speech-recognition'
}
# create Hugging Face Model Class
huggingface_model = HuggingFaceModel(
transformers_version='4.17.0',
pytorch_version='1.10.2',
py_version='py38',
image_uri='763104351884.dkr.ecr.us-west-2.amazonaws.com/huggingface-pytorch-inference:1.10.2-transformers4.17.0-cpu-py38-ubuntu20.04-v1.0',
env=hub,
role=role,
)
# deploy model to SageMaker Inference
predictor = huggingface_model.deploy(
initial_instance_count=1, # number of instances
instance_type='ml.m5.xlarge' # ec2 instance type
)
result = predictor.predict({"inputs":"audio.wav"})
print(result)
But the predict
function throws an Exception:
ModelError: An error occurred (ModelError) when calling the InvokeEndpoint operation: Received client error (400) from primary with message "{
"code": 400,
"type": "InternalServerException",
"message": "[Errno 2] No such file or directory: \u0027audio.wav\u0027"
The audio.wav
file is in the same folder as the Jupyter notebook. I can鈥檛 figure out the reason for this Exception. Any clue what might be going wrong? Thanks!