Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Google Vertex AI Automl Model ID is invalid. It should start with 3 letters Error

 
I have trained and deployed a model for image classification (multi-label). When I try to use the following code, I get an error => rpc error: code = InvalidArgument desc = Model ID is invalid. It should start with 3 letters." But in the dashboard If i go to the console.cloud.google.com > vertex ai > model registry and then select version details Tab, The Model_ID does not have any 3 letter prefix in it. Its a plain 18 digit number. Dont know what to do here. Help required.
client, err := automl.NewPredictionClient(ctx)

....

req := &automlpb.PredictRequest{
        Name: fmt.Sprintf("projects/%s/locations/%s/models/%s", "MY_PROJECT_ID", "LOCATION", "MODEL_ID"), //<= where can I get this Model's Prefix
        Payload: &automlpb.ExamplePayload{
            Payload: &automlpb.ExamplePayload_Image{
                Image: &automlpb.Image{
                    Data: &automlpb.Image_ImageBytes{
                        ImageBytes: bytes,
                    },
                },
            },
        },
        // Params is additional domain-specific parameters.
        Params: map[string]string{
            // score_threshold is used to filter the result.
            "score_threshold": "0.1",
        },
    }

    resp, err := client.Predict(ctx, req)
    if err != nil {
         return fmt.Errorf("Predict: %v", err)
    }

 

0 1 609
1 REPLY 1

Hi,

You get the error because you are using the old AutoML API to run predictions. See model_id created when the old AutoML API is used.

Since you have trained your model using Vertex AutoML Classification (you got the 18 digit number), you should use aiplatform to run your predictions. See sample prediction code.