AI开发平台MODELARTS-创建算法:请求示例

时间:2023-12-14 17:10:10

请求示例

创建算法。设置算法名称为“TestModelArtsalgorithm”,描述为“This is a ModelArts algorithm”。

POST https://endpoint/v2/{project_id}/algorithms

{
  "metadata" : {
    "name" : "TestModelArtsalgorithm",
    "description" : "This is a ModelArts algorithm"
  },
  "job_config" : {
    "code_dir" : "/algo-test/pytorch/work1/code/",
    "boot_file" : "/algo-test/pytorch/work1/code/test-pytorch.py",
    "parameters" : [ {
      "name" : "test-parameter",
      "value" : "10",
      "constraint" : {
        "type" : "String",
        "editable" : true,
        "required" : false,
        "sensitive" : false,
        "valid_type" : "None",
        "valid_range" : [ ]
      }
    } ],
    "parameters_customization" : true,
    "inputs" : [ {
      "name" : "data_url",
      "description" : "data source."
    } ],
    "outputs" : [ {
      "name" : "train_url",
      "description" : "model output."
    } ],
    "engine" : {
      "engine_name" : "PyTorch",
      "engine_version" : "PyTorch-1.3.0-python3.6"
    }
  }
}
support.huaweicloud.com/api-modelarts/CreateAlgorithm.html