华为云用户手册

  • 请求示例 停止step POST https://{endpoint}/v2/{project_id}/workflows/{workflow_id}/executions/4dd2a2f5-bde2-45dd-af6b-5e5d570118d1/step_executions/255a1079-b00a-4c3a-8218-3458f7546b8d/actions { "action_name" : "stop" }
  • 请求参数 表2 请求Body参数 参数 是否必选 参数类型 描述 main_service_id 否 String 在线服务ID。 content_id 否 String Gallery资产ID。 consume 否 WorkflowConsume object 消费信息。 表3 WorkflowConsume 参数 是否必选 参数类型 描述 period 否 String 付费工作流计费周期。 value 否 Long 付费工作流可使用的时间值。
  • 请求示例 对在线服务进行鉴权。设置付费工作流计费周期为“day”,付费工作流可使用的时间为“100”。 POST https://{endpoint}/v2/{project_id}/workflows/service/auth { "content_id" : "xxx", "main_service_id" : "xxx", "consume" : { "period" : "day", "value" : 100 } }
  • 响应示例 状态码: 201 定时调度信息。 { "created_at" : "2022-11-02T09:40:52.714656752+08:00", "uuid" : "fa4ac58e-088b-4fd7-ae8c-b36fee50f884", "type" : "time", "content" : { "cron" : "0 0 0 * * Thu", "method" : "fixed" }, "action" : "run", "policies" : { "on_failure" : "retry", "on_running" : "cancel" }, "workflow_id" : "f1642618-43eb-4ab1-a0b1-9cc584182c60", "user_id" : "75540c679ab44074bc100022d8a4b204", "enable" : true }
  • 请求示例 创建Workflow定时调度。设置类型为“time”,动作为“run”,调度策略on_failure为“retry”、on_running为“cancel”。 POST https://{endpoint}/v2/{project_id}/workflows/{workflow_id}/schedules { "type" : "time", "action" : "run", "content" : { "cron" : "0 0 0 * * Thu", "method" : "fixed" }, "policies" : { "on_failure" : "retry", "on_running" : "cancel" } }
  • 响应参数 状态码: 201 表5 响应Body参数 参数 参数类型 描述 status String 服务包状态。 pool_id String 资源池ID。 service_id String 在线服务ID。 workflow_id String Workflow工作流ID。 order WorkflowPoolOrder object 订阅信息。 consume_limit Integer 消费限制。 current_consume Integer 当前消费。 current_date String 当前时间。 limit_enable Boolean 限制开关。 created_at String 创建时间。 package_id String 订阅包的UUID。创建时不需要填,由后台自动生成。 表6 WorkflowPoolOrder 参数 参数类型 描述 id String 订阅ID。 sku SkuInfo object 订阅计费信息。 sku_count String 订阅计数。 表7 SkuInfo 参数 参数类型 描述 code String 计费码。 period String 计费时期。 queries_limit Long 查询次数。 price Float 价格。
  • 请求参数 表2 请求Body参数 参数 是否必选 参数类型 描述 status 否 String 服务包状态。 pool_id 是 String 资源池ID。 service_id 否 String 在线服务ID。 workflow_id 否 String Workflow工作流ID。 order 是 WorkflowPoolOrder object 订阅信息。 consume_limit 否 Integer 消费限制。 current_consume 否 Integer 当前消费。 current_date 否 String 当前时间。 limit_enable 否 Boolean 限制开关。 created_at 否 String 创建时间。 package_id 否 String 订阅包的UUID。创建时不需要填,由后台自动生成。 表3 WorkflowPoolOrder 参数 是否必选 参数类型 描述 id 否 String 订阅ID。 sku 是 SkuInfo object 订阅计费信息。 sku_count 是 String 订阅计数。 表4 SkuInfo 参数 是否必选 参数类型 描述 code 否 String 计费码。 period 否 String 计费时期。 queries_limit 否 Long 查询次数。 price 否 Float 价格。
  • 响应示例 状态码: 201 OK { "created_at" : "2022-10-31T21:49:08.9729616+08:00", "package_id" : "33820375-d1bf-4751-93fe-9d0ee7b6829e", "status" : "available", "pool_id" : "pool-9ad2-04f258c84780d5a52f3bc00dc15aa5e7", "service_id" : "f4e78e17-5af4-4b65-b677-382d0d2e1b84", "workflow_id" : "b0f91eb4-431e-4acd-8d70-ef081435a6d0", "order" : { "id" : " CS 2210201956MBE5Z", "sku" : { "code" : "modelarts.dplan.workflow", "period" : "day", "queries_limit" : 1000, "price" : 4 }, "sku_count" : 1 }, "consume_limit" : 1000 }
  • 请求示例 给指定的工作流购买资源包 POST https://{endpoint}/v2/{project_id}/workflows{workflow_id}/service/packages { "pool_id" : "pool-9ad2-04f258c84780d5a52f3bc00dc15aa5e7", "order" : { "id" : "CS2210201956MBE5Z", "sku" : { "code" : "modelarts.dplan.workflow", "period" : "day", "queries_limit" : 1000, "price" : 10 }, "sku_count" : 1 } }
  • URI POST /v2/{project_id}/workflows/{workflow_id}/executions/{execution_id}/actions 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 用户项目ID。获取方法请参见获取项目ID和名称。 workflow_id 是 String 工作流的ID。 execution_id 是 String 工作流执行ID。
  • 响应示例 状态码: 201 OK { "created_at" : "2022-08-25T17:01:52.490825+08:00", "name" : "execution-005", "execution_id" : "4dd2a2f5-bde2-45dd-af6b-5e5d570118d1", "description" : "", "status" : "running", "workspace_id" : "0", "workflow_id" : "bd0ac50e-69b1-4d20-ae38-abb221084fc6", "workflow_name" : "workflow-service-infer", "steps_execution" : [ { "created_at" : "2022-08-25T17:01:52.500034+08:00", "uuid" : "54979c30-cc48-4eaa-8b0f-b6eb6e000bb5", "step_name" : "service_step", "step_title" : "service_step", "status" : "wait_inputs", "duration" : 1, "events" : [ "2022-08-25 17:01:53 change status from init to wait_inputs" ], "policy" : { } } ], "duration" : 1, "events" : [ "2022-08-25 17:01:53 step service_step change status from init to wait_inputs" ], "data_requirements" : [ { "name" : "si_placeholder1", "type" : "model_list", "delay" : true, "conditions" : [ { "attribute" : "model_name", "operator" : "equal", "value" : "model_test444444222222" } ], "used_steps" : [ "service_step" ] }, { "name" : "si_placeholder2", "type" : "model_list", "delay" : true, "conditions" : [ { "attribute" : "model_name", "operator" : "equal", "value" : "model_test444444222222" }, { "attribute" : "envs", "operator" : "equal", "value" : { "infer_address" : "$ref/consumptions/service_step/service_output/access_address" } } ], "used_steps" : [ "service_step2" ] } ], "parameters" : [ { "name" : "schedule_KZ27", "type" : "int", "format" : "schedule", "description" : "Set how long the deployed service will stop in hours, where -1 means the service will always run", "delay" : true, "used_steps" : [ "service_step", "service_step2" ] }, { "name" : "placeholder_name", "type" : "str", "value" : "model_test4444", "used_steps" : [ "service_step", "service_step2" ] } ], "policies" : { } }
  • 响应示例 状态码: 201 OK { "created_at" : "2022-11-01T21:36:04.264564372+08:00", "name" : "execution-065", "execution_id" : "46c682b6-0310-4774-9c8e-62d7fb7e0b55", "description" : "", "workspace_id" : "0", "workflow_id" : "f1642618-43eb-4ab1-a0b1-9cc584182c60", "workflow_name" : "workflow_model_service_no_modify_xiahou_copy", "steps_execution" : null, "duration" : 0, "data_requirements" : [ { "name" : "model_input", "type" : "obs", "conditions" : [ { "attribute" : "object_type", "operator" : "equal", "value" : "directory" } ], "value" : { "object_type" : [ "DIRECTORY" ], "obs_url" : "/test-crq/train_output/" }, "used_steps" : [ "model_step" ] }, { "name" : "service_model", "type" : "model_list", "delay" : true, "conditions" : [ { "attribute" : "model_name", "operator" : "equal", "value" : "lh-xh" } ], "used_steps" : [ "service_step" ] } ], "parameters" : [ { "name" : "schedule_d5sm", "type" : "int", "format" : "schedule", "description" : "Set how long the deployed service will stop in hours, where -1 means the service will always run", "delay" : true, "used_steps" : [ "service_step" ] } ], "policies" : { } }
  • 响应示例 状态码: 201 OK { "name" : "graph-test-has-condition-step", "description" : "", "workspace_id" : "0", "steps" : [ { "name" : "condition_step_test", "title" : "condition_step_test", "description" : "", "type" : "condition", "conditions" : [ { "type" : "==", "left" : "$ref/parameters/is_true", "right" : true } ], "if_then_steps" : [ "training_job1" ], "else_then_steps" : [ "training_job2" ], "policy" : { } }, { "name" : "training_job1", "title" : "labeling", "description" : "", "type" : "job", "inputs" : [ { "name" : "data_url", "type" : "obs", "data" : "$ref/data/a2ff296da618452daa8243399f06db8e" } ], "outputs" : [ { "name" : "train_url", "type" : "obs", "config" : { "obs_url" : "/test-lh/test-metrics/" } }, { "name" : "service-link", "type" : "service_content", "config" : { "config_file" : "$ref/parameters/service_config1" } } ], "properties" : { "algorithm" : { "id" : "21ef85a8-5e40-4618-95ee-aa48ec224b43", "parameters" : [ ] }, "kind" : "job", "metadata" : { "name" : "workflow-b0b9fa4c06254b2ebb0e48ba1f7a916c" }, "spec" : { "resource" : { "flavor_id" : "$ref/parameters/train_spec", "node_count" : 1, "policy" : "regular" } } }, "depend_steps" : [ "condition_step_test" ], "policy" : { } }, { "name" : "training_job2", "title" : "labeling", "description" : "", "type" : "job", "inputs" : [ { "name" : "data_url", "type" : "obs", "data" : "$ref/data/f78e46676a454ccdacb9907f589f8d67" } ], "outputs" : [ { "name" : "train_url", "type" : "obs", "config" : { "obs_url" : "/test-lh/test-metrics/" } }, { "name" : "service-link", "type" : "service_content", "config" : { "config_file" : "$ref/parameters/service_config2" } } ], "properties" : { "algorithm" : { "id" : "21ef85a8-5e40-4618-95ee-aa48ec224b43", "parameters" : [ ] }, "kind" : "job", "metadata" : { "name" : "workflow-4a4317eb49ad4370bd087e6b726d84cf" }, "spec" : { "resource" : { "flavor_id" : "$ref/parameters/train_spec", "node_count" : 1, "policy" : "regular" } } }, "depend_steps" : [ "condition_step_test" ], "policy" : { } }, { "name" : "training_job3", "title" : "labeling", "description" : "", "type" : "job", "inputs" : [ { "name" : "data_url", "type" : "obs", "data" : "$ref/data/dee65054c96b4bf3b7ac98c0709f9ae0" } ], "outputs" : [ { "name" : "train_url", "type" : "obs", "config" : { "obs_url" : "/test-lh/test-metrics/" } }, { "name" : "service-link", "type" : "service_content", "config" : { "config_file" : "$ref/parameters/service_config3" } } ], "properties" : { "algorithm" : { "id" : "21ef85a8-5e40-4618-95ee-aa48ec224b43", "parameters" : [ ] }, "kind" : "job", "metadata" : { "name" : "workflow-3039303b3ae14f3e9eed416ba6361b1f" }, "spec" : { "resource" : { "flavor_id" : "$ref/parameters/train_spec", "node_count" : 1, "policy" : "regular" } } }, "depend_steps" : [ "training_job1", "training_job2" ], "policy" : { } } ], "labels" : [ "subgraph" ], "data" : [ { "name" : "a2ff296da618452daa8243399f06db8e", "type" : "obs", "value" : { "obs_url" : "/test-lh/test-metrics/" }, "used_steps" : [ "training_job1" ] }, { "name" : "f78e46676a454ccdacb9907f589f8d67", "type" : "obs", "value" : { "obs_url" : "/test-lh/test-metrics/" }, "used_steps" : [ "training_job2" ] }, { "name" : "dee65054c96b4bf3b7ac98c0709f9ae0", "type" : "obs", "value" : { "obs_url" : "/test-lh/test-metrics/" }, "used_steps" : [ "training_job3" ] } ], "parameters" : [ { "name" : "is_true", "type" : "bool", "delay" : true, "value" : true, "used_steps" : [ "condition_step_test" ] }, { "name" : "train_spec", "type" : "str", "format" : "flavor", "description" : "training specificaiton", "default" : "modelarts.vm.cpu.8u", "used_steps" : [ "training_job1", "training_job2", "training_job3" ] }, { "name" : "service_config1", "type" : "str", "default" : "/test-lh/test-metrics/metrics.json", "used_steps" : [ "training_job1" ] }, { "name" : "service_config2", "type" : "str", "default" : "/test-lh/test-metrics/metrics.json", "used_steps" : [ "training_job2" ] }, { "name" : "service_config3", "type" : "str", "default" : "/test-lh/test-metrics/metrics.json", "used_steps" : [ "training_job3" ] } ] }
  • 请求示例 创建Workflow工作流。设置工作流名称为“graph-test-has-condition-step”。 POST https://{endpoint}/v2/{project_id}/workflows { "name" : "graph-test-has-condition-step", "description" : "", "workspace_id" : "0", "steps" : [ { "name" : "condition_step_test", "title" : "condition_step_test", "description" : "", "type" : "condition", "conditions" : [ { "type" : "==", "left" : "$ref/parameters/is_true", "right" : true } ], "if_then_steps" : [ "training_job1" ], "else_then_steps" : [ "training_job2" ], "policy" : { } }, { "name" : "training_job1", "title" : "labeling", "description" : "", "type" : "job", "inputs" : [ { "name" : "data_url", "type" : "obs", "data" : "$ref/data/a2ff296da618452daa8243399f06db8e" } ], "outputs" : [ { "name" : "train_url", "type" : "obs", "config" : { "obs_url" : "/test-lh/test-metrics/" } }, { "name" : "service-link", "type" : "service_content", "config" : { "config_file" : "$ref/parameters/service_config1" } } ], "properties" : { "algorithm" : { "id" : "21ef85a8-5e40-4618-95ee-aa48ec224b43", "parameters" : [ ] }, "kind" : "job", "metadata" : { "name" : "workflow-b0b9fa4c06254b2ebb0e48ba1f7a916c" }, "spec" : { "resource" : { "flavor_id" : "$ref/parameters/train_spec", "node_count" : 1, "policy" : "regular" } } }, "depend_steps" : [ "condition_step_test" ], "policy" : { } }, { "name" : "training_job2", "title" : "labeling", "description" : "", "type" : "job", "inputs" : [ { "name" : "data_url", "type" : "obs", "data" : "$ref/data/f78e46676a454ccdacb9907f589f8d67" } ], "outputs" : [ { "name" : "train_url", "type" : "obs", "config" : { "obs_url" : "/test-lh/test-metrics/" } }, { "name" : "service-link", "type" : "service_content", "config" : { "config_file" : "$ref/parameters/service_config2" } } ], "properties" : { "algorithm" : { "id" : "21ef85a8-5e40-4618-95ee-aa48ec224b43", "parameters" : [ ] }, "kind" : "job", "metadata" : { "name" : "workflow-4a4317eb49ad4370bd087e6b726d84cf" }, "spec" : { "resource" : { "flavor_id" : "$ref/parameters/train_spec", "node_count" : 1, "policy" : "regular" } } }, "depend_steps" : [ "condition_step_test" ], "policy" : { } }, { "name" : "training_job3", "title" : "labeling", "description" : "", "type" : "job", "inputs" : [ { "name" : "data_url", "type" : "obs", "data" : "$ref/data/dee65054c96b4bf3b7ac98c0709f9ae0" } ], "outputs" : [ { "name" : "train_url", "type" : "obs", "config" : { "obs_url" : "/test-lh/test-metrics/" } }, { "name" : "service-link", "type" : "service_content", "config" : { "config_file" : "$ref/parameters/service_config3" } } ], "properties" : { "algorithm" : { "id" : "21ef85a8-5e40-4618-95ee-aa48ec224b43", "parameters" : [ ] }, "kind" : "job", "metadata" : { "name" : "workflow-3039303b3ae14f3e9eed416ba6361b1f" }, "spec" : { "resource" : { "flavor_id" : "$ref/parameters/train_spec", "node_count" : 1, "policy" : "regular" } } }, "depend_steps" : [ "training_job1", "training_job2" ], "policy" : { } } ], "labels" : [ "subgraph" ], "data" : [ { "name" : "a2ff296da618452daa8243399f06db8e", "type" : "obs", "value" : { "obs_url" : "/test-lh/test-metrics/" }, "used_steps" : [ "training_job1" ] }, { "name" : "f78e46676a454ccdacb9907f589f8d67", "type" : "obs", "value" : { "obs_url" : "/test-lh/test-metrics/" }, "used_steps" : [ "training_job2" ] }, { "name" : "dee65054c96b4bf3b7ac98c0709f9ae0", "type" : "obs", "value" : { "obs_url" : "/test-lh/test-metrics/" }, "used_steps" : [ "training_job3" ] } ], "parameters" : [ { "name" : "is_true", "type" : "bool", "delay" : true, "value" : true, "used_steps" : [ "condition_step_test" ] }, { "name" : "train_spec", "type" : "str", "format" : "flavor", "description" : "training specification", "default" : "modelarts.vm.cpu.8u", "used_steps" : [ "training_job1", "training_job2", "training_job3" ] }, { "name" : "service_config1", "type" : "str", "default" : "/test-lh/test-metrics/metrics.json", "used_steps" : [ "training_job1" ] }, { "name" : "service_config2", "type" : "str", "default" : "/test-lh/test-metrics/metrics.json", "used_steps" : [ "training_job2" ] }, { "name" : "service_config3", "type" : "str", "default" : "/test-lh/test-metrics/metrics.json", "used_steps" : [ "training_job3" ] } ] }
  • 响应示例 状态码: 201 ok { "kind" : "job", "metadata" : { "id" : "425b7087-83de-49ed-9e40-5bb642be956f", "name" : "TestModelArtsJob", "description" : "This is a ModelArts job", "create_time" : 1637045545982, "workspace_id" : "0", "user_name" : "" }, "status" : { "phase" : "Creating", "secondary_phase" : "Creating", "duration" : 0, "start_time" : 0, "node_count_metrics" : null, "tasks" : [ "worker-0", "server-0" ] }, "algorithm" : { "id" : "3f5d6706-7b67-408d-8ba0-ec08048c45ed", "name" : "ttt-obs-gpu", "code_dir" : "/cn-north-4-rse/test/moxingtest-code/", "boot_file" : "/cn-north-4-rse/test/moxingtest-code/test_obs_gpu.py", "parameters" : [ { "name" : "input_dir", "description" : "", "i18n_description" : null, "value" : "s://cn-north-4-rse/test/moxingtest-dir/", "constraint" : { "type" : "String", "editable" : true, "required" : true, "sensitive" : false, "valid_type" : "None", "valid_range" : [ ] } }, { "name" : "input_file", "description" : "", "i18n_description" : null, "value" : "obs://cn-north-4-rse/test/moxingtest/", "constraint" : { "type" : "String", "editable" : true, "required" : true, "sensitive" : false, "valid_type" : "None", "valid_range" : [ ] } }, { "name" : "large_file_method", "description" : "", "i18n_description" : null, "value" : "1", "constraint" : { "type" : "Integer", "editable" : true, "required" : true, "sensitive" : false, "valid_type" : "None", "valid_range" : [ ] } } ], "engine" : { "engine_id" : "horovod-cp36-tf-1.16.2", "engine_name" : "Horovod", "engine_version" : "0.16.2-TF-1.13.1-python3.6" }, "policies" : { } }, "spec" : { "resource" : { "policy" : "regular", "flavor_id" : "modelarts.p3.large.public.free", "flavor_name" : "Computing GPU(Vnt1) instance", "node_count" : 1, "flavor_detail" : { "flavor_type" : "GPU", "billing" : { "code" : "modelarts.vm.gpu.free", "unit_num" : 1 }, "flavor_info" : { "cpu" : { "arch" : "x86", "core_num" : 8 }, "gpu" : { "unit_num" : 1, "product_name" : "GP-Vnt1", "memory" : "32GB" }, "memory" : { "size" : 64, "unit" : "GB" } } } }, "log_export_path" : { } } } 状态码: 400 通用的错误应答消息体格式;如下为id是3f5d6706-7b67-408d-8ba0-ec08048c45ee的算法未找到时的返回信息。 { "error_msg" : "algorithm not found.", "error_code" : "ModelArts.2755", "error_solution" : "Check whether the training project information in the request is valid." }
  • 请求示例 创建免费规格的训练作业。设置作业名称为“TestModelArtsJob”,描述为“This is a ModelArts job”。算法依赖的是id为3f5d6706-7b67-408d-8ba0-ec08048c45ed的算法,该算法未定义inputs与outputs,规格选用的是gpu免费规格。 POST https://endpoint/v2/{project_id}/training-jobs { "kind" : "job", "metadata" : { "name" : "TestModelArtsJob", "description" : "This is a ModelArts job" }, "algorithm" : { "id" : "3f5d6706-7b67-408d-8ba0-ec08048c45ed", "parameters" : [ { "name" : "input_dir", "value" : "obs://cn-north-4-rse/test/moxingtest-dir/" }, { "name" : "input_file", "value" : "obs://cn-north-4-rse/test/moxingtest/" }, { "name" : "large_file_method", "value" : "1" } ], "policies" : { "auto_search" : null }, "environments" : { } }, "spec" : { "resource" : { "flavor_id" : "modelarts.p3.large.public.free", "node_count" : 1 }, "log_export_path" : { "obs_url" : "" } } } 使用 自定义镜像 创建训练作业。设置作业名称为“TestModelArtsJob2”,描述为“This is a ModelArts job2”的自定义镜像训练作业。使用专属资源池和nfs挂载。 POST https://endpoint/v2/{project_id}/training-jobs { "kind" : "job", "metadata" : { "name" : "TestModelArtsJob2", "description" : "This is a ModelArts job2" }, "algorithm" : { "engine" : { "image_url" : "xxxxxxxx/fastseq:1.2" }, "command" : "cd /home/ma-user/ddp_demo && sh run_ddp.sh", "parameters" : [ ], "policies" : { "auto_search" : null }, "environments" : { "NCCL_DEBUG" : "INFO", "NCCL_IB_DISABLE" : "0" } }, "spec" : { "resource" : { "flavor_id" : "modelarts.pool.visual.xlarge", "node_count" : 1, "pool_id" : "poolfaf38d76" }, "log_export_path" : { "obs_url" : "/cn-north-4-training-test/limou/ddp-demo-log/" }, "volumes" : [ { "nfs" : { "nfs_server_path" : "192.168.0.82:/", "local_path" : "/home/ma-user/nfs/", "read_only" : false } } ] } }
  • 请求参数 表2 请求Body参数 参数 是否必选 参数类型 描述 metadata 是 TrainingExperimentRequestMetadata object 训练实验创建参数 表3 TrainingExperimentRequestMetadata 参数 是否必选 参数类型 描述 name 是 String 实验名称,最大长度64,不支持特殊字符。 description 否 String 描述信息,最大长度256,不支持特殊字符。 workspace_id 否 String 工作空间ID,默认为0。
  • 响应示例 状态码: 200 OK { "metadata" : { "id" : "6ccc15e6-8a81-4d8e-8bee-53401d850639", "name" : "test", "description" : "demo", "create_time" : 1731552542622, "workspace_id" : "0", "update_time" : 1731552542000 }, "statistic" : { "job_count" : 0 } }
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 metadata TrainingExperimentResponseMetadata object 训练实验数据。 statistic TrainingExperimentStatistic object 训练实验的统计数据。 表5 TrainingExperimentResponseMetadata 参数 参数类型 描述 name String 实验名称,最大长度64,不支持特殊字符。 description String 描述信息,最大长度256,不支持特殊字符。 workspace_id String 工作空间ID,默认为0。 create_time Integer 创建时间。 update_time Integer 更新时间。 id String 实验ID。 表6 TrainingExperimentStatistic 参数 参数类型 描述 job_count Integer 当前实验下的训练作业总个数。
  • 请求示例 创建训练作业标签。设置TMS标签的key/value为“111”和“k3”,TMS标签的key/value为"k3"和“v2”。 POST https://endpoint/v2/{project_id }/trainJob/{training_job_id}/tags/create { "tags" : [ { "key" : "111", "value" : "v2" }, { "key" : "k3", "value" : "v2" } ] }
  • 功能介绍 启动智能任务,支持启动“智能标注”和“自动分组”两大类智能任务。可通过指定请求体中的“task_type”参数来启动某类任务。数据路径或工作路径位于KMS加密桶的数据集,不支持启动主动学习和自动分组任务,支持预标注任务。 “智能标注”是指基于当前标注阶段的标签及图片学习训练,选中系统中已有的模型进行智能标注,快速完成剩余图片的标注操作。“智能标注”又包含“主动学习”和“预标注”两类。 “主动学习”表示系统将自动使用半监督学习、难例筛选等多种手段进行智能标注,降低人工标注量,帮助用户找到难例。 “预标注”表示选择用户模型管理里面的模型进行智能标注。 “自动分组”是指先使用聚类算法对未标注图片进行聚类,再根据聚类结果进行处理,可以分组打标或者清洗图片。
  • 请求示例 启动智能标注(主动学习)任务。任务类型选择“auto-label”。 { "task_type" : "auto-label", "collect_key_sample" : true, "config" : { "algorithm_type" : "fast" } } 启动智能标注(预标注)任务。任务类型选择“pre-label”。 { "task_type" : "pre-label", "model_id" : "c4989033-7584-44ee-a180-1c476b810e46", "collect_key_sample" : true, "config" : { "inf_config_list" : [ { "specification" : "modelarts.vm.cpu.2u", "instance_count" : 1 } ] } } 启动自动分组任务。任务类型选择“auto-grouping”。 { "task_type" : "auto-grouping", "config" : { "n_clusters" : "2", "ambiguity" : false, "image_brightness" : false, "image_colorfulness" : false, "property" : "size", "result_type" : 1 } }
  • 请求示例 请求示例,创建在线服务。 POST https://{endpoint}/v1/{project_id}/services { "infer_type" : "real-time", "service_name" : "mnist", "description" : "mnist service", "config" : [ { "specification" : "modelarts.vm.cpu.2u", "weight" : 100, "model_id" : "0e07b41b-173e-42db-8c16-8e1b44cc0d44", "instance_count" : 1 } ] } 请求示例,创建在线服务且配置多版本分流。 POST https://{endpoint}/v1/{project_id}/services { "service_name" : "mnist", "description" : "mnist service", "infer_type" : "real-time", "config" : [ { "model_id" : "xxxmodel-idxxx", "weight" : "70", "specification" : "modelarts.vm.cpu.2u", "instance_count" : 1, "envs" : { "model_name" : "mxnet-model-1", "load_epoch" : "0" } }, { "model_id" : "xxxxxx", "weight" : "30", "specification" : "modelarts.vm.cpu.2u", "instance_count" : 1 } ] } 请求示例,创建专属资源池自定义规格在线服务样例。 POST https://{endpoint}/v1/{project_id}/services { "service_name" : "realtime-demo", "description" : "", "infer_type" : "real-time", "cluster_id" : "8abf68a969c3cb3a0169c4acb24b0000", "config" : [ { "model_id" : "eb6a4a8c-5713-4a27-b8ed-c7e694499af5", "weight" : "100", "cluster_id" : "8abf68a969c3cb3a0169c4acb24b0000", "specification" : "custom", "custom_spec" : { "cpu" : 1.5, "memory" : 7500 }, "instance_count" : 1 } ] } 请求示例,创建在线服务设置自动停止。 POST https://{endpoint}/v1/{project_id}/services { "service_name" : "service-demo", "description" : "demo", "infer_type" : "real-time", "config" : [ { "model_id" : "xxxmodel-idxxx", "weight" : "100", "specification" : "modelarts.vm.cpu.2u", "instance_count" : 1 } ], "schedule" : [ { "type" : "stop", "time_unit" : "HOURS", "duration" : 1 } ] } 请求示例,创建批量服务且输入数据映射方式为“file”。 POST https://{endpoint}/v1/{project_id}/services { "service_name" : "batchservicetest", "description" : "", "infer_type" : "batch", "cluster_id" : "8abf68a969c3cb3a0169c4acb24b****", "config" : [ { "model_id" : "598b913a-af3e-41ba-a1b5-bf065320f1e2", "specification" : "modelarts.vm.cpu.2u", "instance_count" : 1, "src_path" : "https://infers-data.obs.xxxxx.com/xgboosterdata/", "dest_path" : "https://infers-data.obs.xxxxx.com/output/", "req_uri" : "/", "mapping_type" : "file" } ] } 请求示例,创建批量服务且输入数据映射方式为“csv”。 POST https://{endpoint}/v1/{project_id}/services { "service_name" : "batchservicetest", "description" : "", "infer_type" : "batch", "config" : [ { "model_id" : "598b913a-af3e-41ba-a1b5-bf065320f1e2", "specification" : "modelarts.vm.cpu.2u", "instance_count" : 1, "src_path" : "https://infers-data.obs.xxxxx.com/xgboosterdata/", "dest_path" : "https://infers-data.obs.xxxxx.com/output/", "req_uri" : "/", "mapping_type" : "csv", "mapping_rule" : { "type" : "object", "properties" : { "data" : { "type" : "object", "properties" : { "req_data" : { "type" : "array", "items" : [ { "type" : "object", "properties" : { "input5" : { "type" : "number", "index" : 0 }, "input4" : { "type" : "number", "index" : 1 }, "input3" : { "type" : "number", "index" : 2 }, "input2" : { "type" : "number", "index" : 3 }, "input1" : { "type" : "number", "index" : 4 } } } ] } } } } } } ] } 请求示例,创建边缘服务样例。 POST https://{endpoint}/v1/{project_id}/services { "service_name" : "service-edge-demo", "description" : "", "infer_type" : "edge", "config" : [ { "model_id" : "eb6a4a8c-5713-4a27-b8ed-c7e694499af5", "specification" : "custom", "instance_count" : 1, "custom_spec" : { "cpu" : 1.5, "memory" : 7500 }, "envs" : { }, "nodes" : [ "2r8c4fb9-t497-40u3-89yf-skui77db0472" ] } ] }
  • 请求示例 如下以创建uuid为2cd88daa-31a4-40a8-a58f-d186b0e93e4f的训练作业对应worker-0镜像保存任务为例。 POST https://endpoint/v2/{project_id}/training-jobs/2cd88daa-31a4-40a8-a58f-d186b0e93e4f/tasks/worker-0/save-image-job { "name" : "imagesave", "namespace" : "dev", "tag" : 0.1, "description" : "hello world!" }
  • 响应参数 状态码: 201 表3 响应Body参数 参数 参数类型 描述 name String 镜像名称,长度限制512个字符,支持小写字母、数字、中划线、下划线和点。 namespace String 镜像所属组织,可以在SWR控制台“组织管理”创建和查看。 tag String 镜像tag,长度限制64个字符, 支持大小写字母、数字、中划线、下划线和点。 description String 该镜像所对应的描述信息,长度限制512个字符。 status String 镜像状态。枚举值如下: INIT:初始化。 CREATING:镜像保存中,此时训练作业不可用。 CREATE_FAILED:镜像保存失败。 ACTIVE:镜像保存成功,保存的镜像可以在SWR控制台查看,同时可以基于保存的镜像创建训练作业。 message String 镜像创建的时间,UTC毫秒。 create_time Long 镜像保存操作过程中,展示构建信息。
  • URI POST /v2/{project_id}/training-jobs/{training_job_id}/tasks/{task_id}/save-image-job 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 用户项目ID。获取方法请参见获取项目ID和名称。 training_job_id 是 String 训练作业ID。获取方法请参见查询训练作业列表。 task_id 是 String 训练作业的任务名称。可从训练作业详情中的status.tasks字段中获取。
  • 响应示例 状态码: 201 create image save job successfully { "name" : "imagesave", "namespace" : "dev", "tag" : 0.1, "description" : "hello world!", "status" : "ACTIVE", "message" : "building", "create_time" : 1686718209968 }
  • 请求参数 表2 请求Body参数 参数 是否必选 参数类型 描述 name 否 String 镜像名称,长度限制512个字符,支持小写字母、数字、中划线、下划线和点。 namespace 否 String 镜像所属组织,可以在SWR控制台“组织管理”创建和查看。 tag 否 String 镜像tag,长度限制64个字符, 支持大小写字母、数字、中划线、下划线和点。 description 否 String 该镜像所对应的描述信息,长度限制512个字符。
  • 请求示例 创建数据校验任务的版本。设置任务名称为“PRE-e77c”。 { "name" : "PRE-e77c", "inputs" : [ { "type" : "DATASET", "source" : "PYc9H2HGv5BJNwBGXyK", "version_id" : "Osc8SZ7TZStiRV4vYkZ" } ], "work_path" : { "type" : "DATASET", "path" : "PYc9H2HGv5BJNwBGXyK", "version_name" : "V0011" }, "description" : "", "template" : { "id" : "sys_data_validation", "operator_params" : [ { "name" : "MetaValidation", "advanced_params_switch" : false, "params" : { "task_type" : "image_classification", "dataset_type" : "manifest", "source_service" : "select", "filter_func" : "data_validation_select", "image_max_width" : "1920", "image_max_height" : "1920", "total_status" : "[0,1,2]" } } ] }, "workspace_id" : "0" }
  • 请求示例 创建特征分析任务。设置任务类型为“sys_data_analyse”。 { "name" : "V001", "description" : "", "data_source" : { "type" : "DATASET", "source" : "X6c3N3eztX7cr3Arvqu" }, "template" : { "id" : "sys_data_analyse", "operator_params" : [ { "id" : "sys_data_analyse", "params" : { "op_list" : [ ] } } ] }, "version_id" : "J4Eh2FDEWH1qnDlD3hQ" } 创建数据处理(数据校验)任务。设置任务类型为“sys_data_validation”。 { "name" : "PRE-e77c", "inputs" : [ { "type" : "DATASET", "source" : "PYc9H2HGv5BJNwBGXyK", "version_id" : "yoJ5ssClpNlOrsjjFDa" } ], "work_path" : { "type" : "DATASET", "path" : "PYc9H2HGv5BJNwBGXyK", "version_name" : "V0010" }, "description" : "", "create_version" : true, "template" : { "id" : "sys_data_validation", "operator_params" : [ { "name" : "MetaValidation", "advanced_params_switch" : false, "params" : { "task_type" : "image_classification", "dataset_type" : "manifest", "source_service" : "select", "filter_func" : "data_validation_select", "image_max_width" : "1920", "image_max_height" : "1920", "total_status" : "[0,1,2]" } } ] }, "workspace_id" : "0" } 创建数据处理(数据清洗)任务。设置任务类型为“sys_data_cleaning”。 { "name" : "PRE-330f", "inputs" : [ { "type" : "DATASET", "source" : "gfghHSokody6AJigS5A", "version_id" : "54IXbeJhfttGpL46lbv" } ], "work_path" : { "type" : "DATASET", "path" : "gfghHSokody6AJigS5A", "version_name" : "V004" }, "description" : "", "create_version" : true, "template" : { "id" : "sys_data_cleaning", "operator_params" : [ { "name" : "PCC", "advanced_params_switch" : false, "params" : { "task_type" : "image_classification", "dataset_type" : "manifest", "source_service" : "select", "filter_func" : "data_cleaning_select", "prototype_sample_path" : "obs://test-obs/classify/data/animals/", "criticism_sample_path" : "", "n_clusters" : "auto", "simlarity_threshold" : "0.9", "embedding_distance" : "0.2", "checkpoint_path" : "/home/work/user-job-dir/test-lxm/resnet_v1_50", "total_status" : "[0,2]", "do_validation" : "True" } } ] }, "workspace_id" : "0" } 创建数据处理(数据筛选)任务。设置任务类型为“sys_data_selection”。 { "name" : "PRE-aae5", "inputs" : [ { "type" : "DATASET", "source" : "gLNSdlQ1iAAmPgl0Won", "version_id" : "WAVPSYpKE3FggbgRxiK" } ], "work_path" : { "type" : "DATASET", "path" : "gLNSdlQ1iAAmPgl0Won", "version_name" : "V003" }, "description" : "", "create_version" : true, "template" : { "id" : "sys_data_selection", "operator_params" : [ { "name" : "SimDeduplication", "advanced_params_switch" : false, "params" : { "task_type" : "image_classification", "dataset_type" : "manifest", "source_service" : "select", "filter_func" : "data_deduplication_select", "simlarity_threshold" : "0.9", "total_status" : "[0,2]", "do_validation" : "True" } } ] }, "workspace_id" : "0" } 创建数据处理(数据增强)任务。设置任务类型为“sys_data_augmentation”。 { "name" : "PRE-637c", "inputs" : [ { "type" : "DATASET", "source" : "XGrRZuCV1qmMxnsmD5u", "version_id" : "kjPDTOSi6BQqhtXZlFv" } ], "work_path" : { "type" : "DATASET", "path" : "XGrRZuCV1qmMxnsmD5u", "version_name" : "V002" }, "description" : "", "create_version" : true, "template" : { "id" : "sys_data_augmentation", "operator_params" : [ { "name" : "AddNoise", "advanced_params_switch" : false, "params" : { "task_type" : "image_classification", "dataset_type" : "manifest", "noise_type" : "Gauss", "loc" : "0", "scale" : "1", "lam" : "2", "p" : "0.01", "total_status" : "[3]", "filter_func" : "data_augmentation", "do_validation" : "True" } } ] }, "workspace_id" : "0" }
共100000条