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

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