SentenceTransformerModel.make_model_config_json
- opensearch_py_ml.ml_models.SentenceTransformerModel.make_model_config_json(self, model_name: str | None = None, version_number: str = 1, model_format: str = 'TORCH_SCRIPT', model_zip_file_path: str | None = None, embedding_dimension: int | None = None, pooling_mode: str | None = None, normalize_result: bool | None = None, description: str | None = None, all_config: str | None = None, model_type: str | None = None, verbose: bool = False) str
Parse from config.json file of pre-trained hugging-face model to generate a ml-commons_model_config.json file. If all required fields are given by users, use the given parameters and will skip reading the config.json
- Parameters:
model_name (string) – Optional, The name of the model. If None, default is model id, for example, ‘sentence-transformers/msmarco-distilbert-base-tas-b’
model_format (string) – Optional, the format of the model. Default is “TORCH_SCRIPT”.
model_zip_file_path (string) – Optional, path to the model zip file. Default is the zip file path used in save_as_pt or save_as_onnx depending on model_format. This zip file is used to compute model_content_size_in_bytes and model_content_hash_value.
version_number (string) – Optional, The version number of the model. Default is 1
embedding_dimension (int) – Optional, the embedding dimension of the model. If None, get embedding_dimension from the pre-trained hugging-face model object.
pooling_mode (string) – Optional, the pooling mode of the model. If None, get pooling_mode from the pre-trained hugging-face model object.
normalize_result – Optional, whether to normalize the result of the model. If None, check from the pre-trained
hugging-face model object. :type normalize_result: bool :param description: Optional, the description of the model. If None, get description from the README.md
file in the model folder.
- Parameters:
all_config (dict) – Optional, the all_config of the model. If None, parse all contents from the config file of pre-trained hugging-face model
model_type (string) – Optional, the model_type of the model. If None, parse model_type from the config file of pre-trained hugging-face model
verbose (bool) – optional, use printing more logs. Default as false
- Returns:
model config file path. The file path where the model config file is being saved
- Return type:
string