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

时间:2025-02-12 15:15:41

请求示例

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

POST https://endpoint/v2/{project_id}/algorithms{  "metadata" : {    "name" : "TestModelArtsalgorithm",    "description" : "This is a ModelArts algorithm"  },  "advanced_config" : {    "auto_search" : {      "algo_configs" : [ {        "name" : "bayes_opt_search",        "params" : [ {          "key" : "kind",          "value" : "ucb",          "type" : "String"        }, {          "key" : "kappa",          "value" : "2.5",          "type" : "Float"        }, {          "key" : "xi",          "value" : "0.0",          "type" : "Float"        }, {          "key" : "num_samples",          "value" : "20",          "type" : "Integer"        }, {          "key" : "seed",          "value" : "1",          "type" : "Integer"        } ]      } ],      "reward_attrs" : [ {        "name" : "max_search",        "mode" : "max",        "regex" : "10.0"      } ],      "search_params" : [ {        "name" : "test_search",        "lower_bound" : "1",        "upper_bound" : "10"      } ]    }  },  "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