Upload Pretrained Model

opensearch_py_ml.ml_commons.MLCommonClient.upload_pretrained_model(self, model_name: str, model_version: str, model_format: str, load_model: bool = True, wait_until_loaded: 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 load_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”

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

  • wait_until_loaded (bool) – If load_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

Deprecated since version 2.7.0: Since OpenSearch 2.7.0, you can use register_pretrained_model instead