start-trained-model-deployment.asciidoc 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[start-trained-model-deployment]]
  4. = Start trained model deployment API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Start trained model deployment</titleabbrev>
  8. ++++
  9. Starts a new trained model deployment.
  10. [[start-trained-model-deployment-request]]
  11. == {api-request-title}
  12. `POST _ml/trained_models/<model_id>/deployent/_start`
  13. [[start-trained-model-deployment-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. [[start-trained-model-deployment-desc]]
  18. == {api-description-title}
  19. Currently only `pytorch` models are supported for deployment. When deployed,
  20. the model attempts allocation to every machine learning node.
  21. [[start-trained-model-deployment-path-params]]
  22. == {api-path-parms-title}
  23. `<model_id>`::
  24. (Required, string)
  25. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-id]
  26. [[start-trained-model-deployment-query-params]]
  27. == {api-query-parms-title}
  28. `timeout`::
  29. (Optional, time)
  30. Controls the amount of time to wait for the model to deploy. Defaults
  31. to 20 seconds.
  32. `wait_for`::
  33. (Optional, string)
  34. Specifies the allocation status to wait for before returning. Defaults to
  35. `started`. The value `starting` indicates deployment is starting but not yet on
  36. any node. The value `started` indicates the model has started on at least one
  37. node. The value `fully_allocated` indicates the deployment has started on all
  38. valid nodes.
  39. [[start-trained-model-deployment-example]]
  40. == {api-examples-title}
  41. The following example starts a new deployment for a
  42. `elastic__d`istilbert-base-uncased-finetuned-conll03-english` trained model:
  43. [source,console]
  44. --------------------------------------------------
  45. POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_start?wait_for=started&timeout=1m
  46. --------------------------------------------------
  47. // TEST[skip:TBD]
  48. The API returns the following results:
  49. [source,console-result]
  50. ----
  51. {
  52. "allocation": {
  53. "task_parameters": {
  54. "model_id": "elastic__distilbert-base-uncased-finetuned-conll03-english",
  55. "model_bytes": 265632637
  56. },
  57. "routing_table": {
  58. "uckeG3R8TLe2MMNBQ6AGrw": {
  59. "routing_state": "started",
  60. "reason": ""
  61. }
  62. },
  63. "allocation_state": "started"
  64. }
  65. }
  66. ----