elastic / elastic/package-spec

[Change Proposal] Support Torch `.pt` ML trained models in integration packages

Open
#830 0 comments 0 reactions 0 assignees View on GitHub
discuss Team:Integrations
Dominant language
Go
Stars
20
Forks
93
Avg merge
15h 10m
Merged PRs (30d)
12

Description

## What problem is this proposal solving?

Users should be able to easily install supervised ML models. Current, integrations support DataFrame Analytics models, as introduced in
* https://github.com/elastic/package-spec/issues/216

Now we have more [supported language models](https://www.elastic.co/guide/en/machine-learning/current/ml-nlp-model-ref.html). They are shipped in a `.pt` format instead of `.json` configurations. Integrations will need to support the installation of these models.

* Note: Trained model API [compressed_definition](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-trained-models.html#ml-put-trained-models-request-body). The .pt models will need to be converted to base64 format to place into the integration packages.
* Note: To support NLP models, support for the add trained models' vocabulary is required as well. [link](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-trained-model-vocabulary.html)

## Where the solution will need to be implemented, i.e. which parts, if any, of the Elastic Stack will be impacted.

- [ ] Create PR in the https://github.com/elastic/package-spec repo to update the ml_model asset type. Possibly in [this file?](https://github.com/elastic/package-spec/blob/main/spec/integration/elasticsearch/spec.yml)
- [ ] PR -
- [ ] Create PR in https://github.com/elastic/kibana to add support (installing the asset using the existing create trained model API) for the model asset type into Fleet. Possibly the `handleMlModelInstall` [chunk](https://github.com/alvarezmelissa87/kibana/blob/b83e6c61506ceba55cf932205516eb725ab09dd0/x-pack/plugins/fleet/server/services/epm/elasticsearch/ml_model/install.ts#L45)
- [ ] PR -
- [ ] ? Create PR in https://github.com/elastic/integrations to add the model .pt containing the model and other model package assets themselves

## Additional information

Currently, models are constrained to 400mb size. We've yet to require an increase, but it's worth noting in the future if we do develop larger models.

Links:
* Eland .pt: https://github.com/elastic/eland/blob/79d9a6ae29624d15840a48465fc2aa87dcbf7ace/eland/ml/pytorch/traceable_model.py#L62
* Trained model API [compressed_definition](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-trained-models.html#ml-put-trained-models-request-body). The .pt models will need to be converted to base64 format to place into the integration packages.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.