KeyError: 'sam' error

#4
by payamahv - opened

I am trying to pass an model to this model like this

with open("/root/aws-sam/02.JPG", "rb") as f:
data = f.read()

response = runtime.invoke_endpoint(EndpointName=ENDPOINT_NAME,
ContentType='image/jpeg',
Body=data)

result = json.loads(response['Body'].read().decode())

I am getting this error

2023-10-26T09:42:33.354-07:00

Copy
2023-10-26T16:42:33,265 [INFO ] W-9000-facebook__sam-vit-large-stdout com.amazonaws.ml.mms.wlm.WorkerLifeCycle - raise KeyError(key)
2023-10-26T16:42:33,265 [INFO ] W-9000-facebook__sam-vit-large-stdout com.amazonaws.ml.mms.wlm.WorkerLifeCycle - raise KeyError(key) AllTraffic/i-0dad3e9d16762a67f

2023-10-26T09:42:33.354-07:00

Copy
2023-10-26T16:42:33,265 [INFO ] W-9000-facebook__sam-vit-large-stdout com.amazonaws.ml.mms.wlm.WorkerLifeCycle - KeyError: 'sam'
2023-10-26T16:42:33,265 [INFO ] W-9000-facebook__sam-vit-large-stdout com.amazonaws.ml.mms.wlm.WorkerLifeCycle - KeyError: 'sam' AllTraffic/i-0dad3e9d16762a67f

2023-10-26T09:42:37.363-07:00

Copy
2023-10-26T16:42:33,265 [INFO ] W-9000-facebook__sam-vit-large-stdout com.amazonaws.ml.mms.wlm.WorkerLifeCycle - Model facebook__sam-vit-large loaded io_fd=966296fffe2e23f7-00000015-00000000-a9415483c6ddb70e-6cd401cc
2023-10-26T16:42:33,265 [INFO ] W-9000-facebook__sam-vit-large-stdout com.amazonaws.ml.mms.wlm.WorkerLifeCycle - Model facebook__sam-vit-large loaded io_fd=966296fffe2e23f7-00000015-00000000-a9415483c6ddb70e-6cd401cc

Hi @payamahv
Thanks for raising the issue, can you share a full reproducible small snippet ? What is also the transformers version you are using?

probably you just need to just adding the latest transformers version (transformers==4.25.1) to the requirements.txt file .

The issue is here:
https://www.kaggle.com/code/vinayakshanawad/bring-your-bert-model-to-aws-sagemaker

Hi @payamahv
The latest transformers version is 4.34.1, can you update your transformers version to the latest one and see if you get the same issue?

Sign up or log in to comment