Search code examples
google-cloud-platformgoogle-apigoogle-api-python-clientgoogle-cloud-vertex-ai

GCP AI Platform Vertex endpoint model undeploy : 404 The DeployedModel with ID `2367889687867` is missing


I am trying to un-deploy model from an endpoint following this documentation.

Endpoint.undeploy(deployed_model_id=model_id)

I even tried google api. Same Issue with this as well.

Getting 404 error

The Deployed Model with ID 2367889687867 is missing.

INFO:

  1. Both model and Endpoint are in same region.
  2. There is a single model deployed in the endpoint with traffic_percentage=100.

Solution

  • The deployed_model_id is different from the model_id.That’s why you are getting the Error 404, it is searching for something that is not the same.

    You can get the deployed_model_id by:

    • list_models()
    • list()

    Using list_models() brings you a list of all the deployed models ids, while using list() only brings one, you can add filters such as display_name, model_id, region, etc.

    list(
        filter= ‘display_name= “display_name”’,
    )
    

    You also can get the deployed_model_id using the Cloud SDK.

    gcloud ai models list --region=$REGION --filter="DISPLAY_NAME: $NAME" | grep "MODEL_ID" | cut -f2 -d: | sed 's/\s//'
    

    Additionally, you can specify the deployed_model_id when you are deploying your model using Cloud SDK the command should look like:

    gcloud ai endpoints deploy-model $endpoint --project=$project --region=$region --model=$model_id --display-name=$model_name --deployed-model-id=$deployed_model_id
    

    There are some flags that are required when you deploy a model such as endpoint, project, region, model and display name. And there are others that are optional flags that you can use deployed_model_id is one of them.(I don’t know if this is possible but you could set the deployed_model_id as the same as the model_id).