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

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