Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ML section - local and remote models #5609

Merged
merged 14 commits into from
Nov 17, 2023
Merged

Refactor ML section - local and remote models #5609

merged 14 commits into from
Nov 17, 2023

Conversation

kolchfa-aws
Copy link
Collaborator

@kolchfa-aws kolchfa-aws commented Nov 16, 2023

Description

Refactor ML section - local and remote models

Issues Resolved

Fixes #5591
Fixes #4866
Fixes #4966
Fixes #5559

Checklist

  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and subject to the Developers Certificate of Origin.
    For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
ML Commons supports the following model-level APIs:

- [Register model]({{site.url}}{{site.baseurl}}/ml-commons-plugin/api/model-apis/register-model/)
- [Deploy model]({{site.url}}{{site.baseurl}}/ml-commons-plugin/api/model-apis/deploy-model/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: move this line after Get model?

- [Undeploy model]({{site.url}}{{site.baseurl}}/ml-commons-plugin/api/model-apis/undeploy-model/)
- [Delete model]({{site.url}}{{site.baseurl}}/ml-commons-plugin/api/model-apis/delete-model/)

## Model access control considerations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mainly about model groups, Should we move this to model-group-apis/index.md ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is about model groups but from the perspective of accessing a model. This section gives a brief overview of what models can be accessed by what users and then links to the model access control page for further details. So I think I'll leave this here.


## Request fields

All request fields are required.
Copy link
Contributor

@ylwu-amzn ylwu-amzn Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct.
For different model, they need different fields.

For pretrained model, check https://opensearch.org/docs/latest/ml-commons-plugin/pretrained-models/, the mandatory fields are name, version, model_format

For uploading model via URL, refer to https://github.com/opensearch-project/ml-commons/blob/2.x/docs/model_serving_framework/text_embedding_model_examples.md, mandatory fields:

  • name
  • version
  • function_name
  • model_format
  • model_content_hash_value
  • model_config: {model_type, embedding_dimension, framework_type},
  • url

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
```

## Registering a model containing an internal connector
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refer to https://github.com/opensearch-project/ml-commons/blob/2.x/docs/tutorials/remote_inference.md

For Register remote model, user can use internal connector or connector id (standalone connector)

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Copy link
Collaborator

@vagimeli vagimeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kolchfa-aws Solid documentation. Edits are minimal. I agree with capitalizing the API sections because they serve as headings.

}
```
{% include copy-curl.html %}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete extra blank line

_ml-commons-plugin/api/model-apis/register-model.md Outdated Show resolved Hide resolved
_ml-commons-plugin/api/model-apis/register-model.md Outdated Show resolved Hide resolved
_ml-commons-plugin/cluster-settings.md Outdated Show resolved Hide resolved
"last_update_time": 1689793851101,
"is_async": true
}
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a blank line between lines 208 and 209?

| `model_type` | String | The model type, such as `bert`. For a Hugging Face model, the model type is specified in `config.json`. For an example, see the [`all-MiniLM-L6-v2` Hugging Face model `config.json`](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2/blob/main/config.json#L15). Required. |
| `embedding_dimension` | Integer | The dimension of the model-generated dense vector. For a Hugging Face model, the dimension is specified in the model card. For example, in the [`all-MiniLM-L6-v2` Hugging Face model card](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2), the statement `384 dimensional dense vector space` specifies 384 as the embedding dimension. Required. |
| `framework_type` | String | The framework the model is using. Currently, we support `sentence_transformers` and `huggingface_transformers` frameworks. The `sentence_transformers` model outputs text embeddings directly, so ML Commons does not perform any post processing. For `huggingface_transformers`, ML Commons performs post processing by applying mean pooling to get text embeddings. See the example [`all-MiniLM-L6-v2` Hugging Face model](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) for more details. Required. |
| `all_config` | String | This field is used for reference purposes. You can specify all model configurations in this field. For example, if you are using a Hugging Face model, you can minify the `config.json` file to one line and save its contents in the `all_config` field. Once the model is uploaded, you can use the get model API operation to get all model configurations stored in this field. Optional. |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this read "Get Model API?"


# Profile

The profile API operation returns runtime information about ML tasks and models. The profile operation can help debug model issues at runtime.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this read "Profile API operation?"


# Train

The train API operation trains a model based on a selected algorithm. Training can occur both synchronously and asynchronously.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this read "Train API operation?"

kolchfa-aws and others added 2 commits November 17, 2023 15:54
Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>
@kolchfa-aws kolchfa-aws merged commit 826e677 into main Nov 17, 2023
4 checks passed
@kolchfa-aws kolchfa-aws added the backport 2.11 PR: Backport label for 2.11 label Nov 17, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Nov 17, 2023
* Refactor ML section - local and remote models

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Added command to calculate checksum

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add ONNX format to register API

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add sparse encoding predict example

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add API section

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Refactor the API section

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Typo

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Implemented Vale comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add get connector API

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Reword heading

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Addressed tech review comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Apply suggestions from code review

Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

---------

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>
Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
(cherry picked from commit 826e677)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Naarcha-AWS pushed a commit that referenced this pull request Nov 18, 2023
* Refactor ML section - local and remote models



* Added command to calculate checksum



* Add ONNX format to register API



* Add sparse encoding predict example



* Add API section



* Refactor the API section



* Typo



* Implemented Vale comments



* Add get connector API



* Reword heading



* Addressed tech review comments



* Apply suggestions from code review




---------




(cherry picked from commit 826e677)

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
vagimeli added a commit that referenced this pull request Dec 21, 2023
* Refactor ML section - local and remote models

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Added command to calculate checksum

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add ONNX format to register API

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add sparse encoding predict example

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add API section

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Refactor the API section

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Typo

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Implemented Vale comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add get connector API

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Reword heading

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Addressed tech review comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Apply suggestions from code review

Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

---------

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>
Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
@Naarcha-AWS Naarcha-AWS deleted the ml-example branch March 28, 2024 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.11 PR: Backport label for 2.11
Projects
None yet
3 participants