How do you add "parameters" to a batch prediction job's POST request JSON body?

How do you configure a BatchPredictionJob to include a "parameters" JSON object (i.e., a dict) in the JSON body of each POST request? I've configured a custom-container based Model to expect "parameters" in the body of a given request made to the prediction route as suggested in the custom container "Request requirements" (https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#request_requiremen...).

The "instances" are constructed successfully, but the model_parameters dict I pass to the BatchPredictionJob.create() class method (https://cloud.google.com/python/docs/reference/aiplatform/latest/google.cloud.aiplatform.BatchPredic...) does not result in the addition of a "parameters" (or any other) key-value pair in the resultant request bodies. Is there another way to supply these "parameters"?

Another user on Stack Overflow seemed to share my question, but the answer isn't conclusive: https://stackoverflow.com/questions/69936296/vertex-ai-custom-container-batch-prediction.

If I inspect my BatchPredictionJob instance via to_dict(), the 'modelParameters' dict looks good. Furthermore, the instance's gca_resource.model_parameters MapComposite and gca_resource.model_parameters.pb MessageMapContainer look like they're populated correctly, too.

I tried pointing to a parameters schema YAML file (and parameters_schema_uri successfully populated in the Model's predict_schemata), but that didn't help either.

1 REPLY 1

I have the same issue