Register Pretrained Model

opensearch_py_ml.ml_commons.MLCommonClient.register_pretrained_model(self, model_name: str, model_version: str, model_format: str, model_group_id: str = '', deploy_model: bool = True, wait_until_deployed: bool = True)

This method registers the pretrained model in the opensearch cluster using ml-common plugin’s api. First, this method creates a model id to store model info and then deploys the model if deploy_model is True. The model has to be supported by ML Commons. Refer to https://opensearch.org/docs/latest/ml-commons-plugin/pretrained-models/.

Parameters:
  • model_name (string) – Name of the pretrained model

  • model_version (string) – Version of the pretrained model

  • model_format (string) – “TORCH_SCRIPT” or “ONNX”

  • model_group_id (string) – Model group id

  • deploy_model (bool) – Whether to deploy the model using uploaded model chunks

  • wait_until_deployed (bool) – If deploy_model is true, whether to wait until the model is deployed

Returns:

returns the model_id so that we can use this for further operation

Return type:

string