put-trained-model-definition-part.asciidoc 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. [role="xpack"]
  2. [[put-trained-model-definition-part]]
  3. = Create trained model definition part API
  4. [subs="attributes"]
  5. ++++
  6. <titleabbrev>Create part of a trained model</titleabbrev>
  7. ++++
  8. Creates part of a trained model definition.
  9. [[ml-put-trained-model-definition-part-request]]
  10. == {api-request-title}
  11. `PUT _ml/trained_models/<model_id>/definition/<part_num>`
  12. [[ml-put-trained-model-definition-part-prereq]]
  13. == {api-prereq-title}
  14. Requires the `manage_ml` cluster privilege. This privilege is included in the
  15. `machine_learning_admin` built-in role.
  16. [[ml-put-trained-model-definition-part-path-params]]
  17. == {api-path-parms-title}
  18. `<model_id>`::
  19. (Required, string)
  20. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-id]
  21. `<part>`::
  22. (Required, number)
  23. The definition part number. When the definition is loaded for inference
  24. the definition parts will be streamed in order of their `part_num`.
  25. The first part must be `0` and the final part must be `total_parts - 1`.
  26. [[ml-put-trained-model-definition-part-request-body]]
  27. == {api-request-body-title}
  28. `definition`::
  29. (Required, string)
  30. The definition part for the model. Must be a base64 encoded string.
  31. `total_definition_length`::
  32. (Required, number)
  33. The total uncompressed definition length in bytes. Not base64 encoded.
  34. `total_parts`::
  35. (Required, number)
  36. The total number of parts that will be uploaded. Must be greater than 0.
  37. [[ml-put-trained-model-definition-part-example]]
  38. == {api-examples-title}
  39. The following example creates a model definition part for a previously
  40. stored model configuration. The definition part is stored in the index
  41. that is configured by the `location.index.name`.
  42. NOTE: The value of the `definition` object is elided from the example
  43. as it is a very large base64 encoded string.
  44. [source,console]
  45. --------------------------------------------------
  46. PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/definition/0
  47. {
  48. "definition": "...",
  49. "total_definition_length": 265632637,
  50. "total_parts": 64
  51. }
  52. --------------------------------------------------
  53. // TEST[skip:TBD]
  54. The API returns the following results:
  55. [source,console-result]
  56. ----
  57. {
  58. "acknowledged": true
  59. }
  60. ----