Hi all,
I am following the guide here Demo Notebook for Sentence Transformer Model Training, Saving and Uploading to OpenSearch — Opensearch-py-ml 1.3.0 documentation to upload a local model to OS 3.1.0 but got the below error. Note that the model is downloaded from the OS pretrained models and stored locally. And btw, I was able to upload via rest api with no issues. I only get this error in the python APIs.
RequestError: RequestError(400, ‘illegal_argument_exception’, ‘embedding dimension is null’)
Below are the python steps:
import opensearch_py_ml as oml
from opensearch_py_ml.ml_commons import MLCommonClient
import warnings
warnings.filterwarnings('ignore', category=DeprecationWarning)
warnings.filterwarnings("ignore", message="Unverified HTTPS request")
import opensearch_py_ml as oml
from opensearchpy import OpenSearch
def get_os_client(cluster_url = "https://localhost:9200",
username='admin',
password='Usrch2025!'):
'''
Get OpenSearch client
:param cluster_url: cluster URL like https://ml-te-netwo-1s12ba42br23v-ff1736fa7db98ff2.elb.us-west-2.amazonaws.com:443
:return: OpenSearch client
'''
client = OpenSearch(
hosts=[cluster_url],
http_auth=(username, password),
verify_certs=False
)
return client
client = get_os_client()
ml_client = MLCommonClient(client)
model_path = r'D:\my-files\work\opensearch-releases\os31\models\all-MiniLM-L12-v2-1.0.2-onnx.zip'
model_config_path = r'D:\my-files\work\opensearch-releases\os31\models\config.json'
ml_client.upload_model( model_path, model_config_path, isVerbose=True)