Segment Anything Model (SAM) inference
Hi,I’m working on a project that uses SAM to do image segmentation. I’m trying to deploy the “sam-vit-large” model (found here:facebook/sam-vit-large · Hugging Face) on AWS SageMaker using the code given in the deployment section. I have managed to deploy the endpoint on SageMaker, but I’m not sure what the payload/input I need to give the endpoint is; would it be in json format? If so, what would be the properties?Thanks!
2023-10-16T14:43:35Z
Did you find an answer to this? I would love to know what you found out if so.Thanks!
2023-10-19T04:29:50Z
hi it looks like the HuggingFace sagemaker needs to update the transformers images, currently the latest version support is4.28.1and SAM is only integrated on transformers4.29.0cc@philschmidfor an update. Also my guess is SAM my need a custom inference handler, please lookhttps://github.com/huggingface/notebooks/blob/main/sagemaker/17_custom_inference_script/sagemaker-notebook.ipynb
2023-10-26T18:41:57Z
I am trying to pass an model to this model like this in sagemakerwith open(“/root/aws-sam/02.JPG”, “rb”) as f:data = f.read()#raw_image= Image.open(data).convert(“RGB”)response = runtime.invoke_endpoint(EndpointName=ENDPOINT_NAME,ContentType=‘image/jpeg’,#image/jpeg image/x-image’Body=data)I am getting this error2023-10-26T09:42:33.354-07:00Copy2023-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-0dad3e9d16762a67f2023-10-26T09:42:33.354-07:00Copy2023-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-0dad3e9d16762a67f2023-10-26T09:42:37.363-07:00Copy2023-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-6cd401cc2023-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