云服务器内容精选

  • 请求示例 创建AI应用。设置AI应用名称为“mnist”,版本为“1.0.0”,类型为“TensorFlow”,模型文件来源于OBS桶。 POST https://{endpoint}/v1/{project_id}/models { "model_name" : "mnist", "model_version" : "1.0.0", "source_location" : "https://models.obs.xxxxx.com/mnist", "source_job_id" : "55", "source_job_version" : "V100", "model_type" : "TensorFlow", "runtime" : "python2.7", "description" : "mnist model", "execution_code" : "https://testmodel.obs.xxxxx.com/customize_service.py", "input_params" : [ { "url" : "/v1/xxx/image", "protocol" : "http", "method" : "post", "param_name" : "image_url", "param_type" : "string", "min" : 0, "max" : 9, "param_desc" : "http://test/test.jpeg" } ], "output_params" : [ { "url" : "/v1/xxx/image", "protocol" : "http", "method" : "post", "param_name" : "face_location", "param_type" : "box", "param_desc" : "face_location param value description" } ], "dependencies" : [ { "installer" : "pip", "packages" : [ { "package_name" : "numpy", "package_version" : "1.5.0", "restraint" : "ATLEAST" } ] } ], "model_algorithm" : "object_detection", "model_metrics" : "{\"f1\":0.52381,\"recall\":0.666667,\"precision\":0.466667,\"accuracy\":0.625}", "apis" : [ { "url" : "/v1/xxx/image", "protocol" : "http", "method" : "post", "input_params" : { "type" : "object", "properties" : { "image_url" : { "type" : "string" } } }, "output_params" : { "type" : "object", "properties" : { "face_location" : { "type" : "box" } } } } ], "initial_config" : "{\"protocol\":\"http\",\"port\":\"8080\",\"health\":{\"check_method\":\"HTTP\",\"protocol\":\"http\",\"url\":\"/health\",\"period_seconds\":\"5\",\"failure_threshold\":\"10\",\"initial_delay_seconds\":\"12\"},\"readiness_health\":{\"check_method\":\"HTTP\",\"protocol\":\"http\",\"url\":\"/readiness_health\",\"period_seconds\":\"5\",\"failure_threshold\":\"20\",\"initial_delay_seconds\":\"12\"},\"startup_health\":{\"check_method\":\"HTTP\",\"protocol\":\"http\",\"url\":\"/startup_health\",\"period_seconds\":\"5\",\"failure_threshold\":\"10\",\"initial_delay_seconds\":\"12\"}}" }
  • 接口约束 使用模板导入模型与不使用模板导入这两类导入方式的Body参数要求不一样。以下Body参数说明中以模板参数表示适合使用模板导入模型时填写的参数,非模板参数表示适合不使用模板导入时填写的参数,公共参数表示与导入方式无关的参数。 使用模板导入模型时(model_type为Template),template字段必填,source_location不需要填。 不使用模板导入模型时(即model_type不为Template),source_location必填,template不需要填。
  • 问题现象 订阅的AI应用一直处于等待同步状态,可能原因如下: 我的订阅列表上方提示“由于ModelArts的数据存储、模型导入以及部署上线等功能依赖OBS、SWR等服务,需获取依赖服务的授权后,才能正常使用ModelArts的相关功能。” 图1 AI应用等待同步 单击资产名称左侧小三角或者单击“同步”,报错:ModelArts.0108: 您未被授权执行该操作。 单击资产名称左侧小三角或者单击“同步”,报错:ModelArts.5055: 订阅已过期。