获取训练任务的详情。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求语法
GET /api/v1/trainingjobs/{TrainingJobId} HTTP/1.1
路径参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| TrainingJobId |
string |
是 |
训练任务 ID。 |
train129f212o89d |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
当前API无需请求参数
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| OutputChannels |
array<object> |
训练输出数据配置。 |
|
|
object |
训练输出数据配置。 |
||
| Name |
string |
输出数据名称。 |
model |
| OutputUri |
string |
输出数据链接地址。 |
oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/output/model/ |
| DatasetId |
string |
数据集 ID。 |
d-8o0hh35po15ejcdq2p |
| VersionName |
string |
数据集版本。 |
v1 |
| RoleArn |
string |
||
| Status |
string |
任务状态。 |
Running |
| HyperParameters |
array<object> |
训练超参数配置。 |
|
|
object |
训练超参数配置。 |
||
| Name |
string |
参数名。 |
learning_rate |
| Value |
string |
参数值。 |
0.0001 |
| TrainingJobName |
string |
训练任务名称。 |
qwen_llm |
| TrainingJobId |
string |
训练任务 ID。 |
traini6hhxiq69eo |
| Scheduler |
object |
训练任务调度配置。 |
|
| MaxRunningTimeInSeconds |
string |
最大训练运行时长,单位为秒。数值为 0 时不限制最大运行时常。 |
0 |
| MaxRunningTimeInMinutes |
string |
最大运行时长(分钟)。 |
100 |
| ReasonMessage |
string |
训练任务错误原因。 |
None |
| WorkspaceId |
string |
工作空间 ID。 |
86995 |
| ComputeResource |
object |
计算资源配置。 |
|
| EcsCount |
integer |
Ecs 实例数。 |
1 |
| EcsSpec |
string |
Ecs 型号。 |
ecs.gn5-c8g1.2xlarge |
| ResourceId |
string |
资源配额(Quota)ID。 |
quotam670lixikcl |
| ResourceName |
string |
资源配额名称。 |
quota |
| InstanceCount |
integer |
资源配额使用实例数。 |
1 |
| InstanceSpec |
object |
资源配额实例配置。 |
|
| CPU |
string |
实例 CPU 核数。 |
8 |
| Memory |
string |
实例内存大小,单位为 GiB。 |
32 |
| SharedMemory |
string |
实例共享内存大小,单位为 GiB。 |
32 |
| GPU |
string |
实例 GPU 显卡数量。 |
1 |
| GPUType |
string |
实例 GPU 显卡型号。 |
V100 |
| UseSpotInstance |
boolean |
是否使用抢占式实例。 |
true |
| SpotSpec |
object |
抢占式实例配置。 |
|
| SpotStrategy |
string |
SpotStrategy: 实例的抢占策略,取值范围:
|
SpotWithPriceLimit |
| SpotDiscountLimit |
number |
设置实例的每小时最高价格折扣,参数 SpotStrategy 取值为 SpotWithPriceLimit 时生效。 |
0.9 |
| Labels |
array<object> |
训练任务标签列表。 |
|
|
object |
训练任务标签。 |
||
| Key |
string |
标签名。 |
CreatedBy |
| Value |
string |
标签值。 |
QuickStart |
| AlgorithmProvider |
string |
算法提供方。 |
pai |
| InputChannels |
array<object> |
训练输入数据配置。 |
|
|
object |
训练输入数据配置。 |
||
| DatasetId |
string |
数据集 ID。 |
d-475megosidivjfgfq6 |
| Name |
string |
输入数据名称。 |
model |
| InputUri |
string |
输入数据链接。 |
oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/input/model/ |
| Options |
string |
输入数据的文件系统参数。 |
ossAppendable=true |
| VersionName |
string |
数据集版本。 |
v1 |
| RoleArn |
string |
||
| AlgorithmName |
string |
算法名。 |
llm_training |
| ReasonCode |
string |
训练任务状态码。 |
TrainingJobSucceed |
| GmtModifiedTime |
string |
训练任务状态更新时间。 |
2024-07-10T11:49:47Z |
| StatusTransitions |
array<object> |
训练任务状态变更列表。 |
|
|
object |
训练任务状态变更。 |
||
| EndTime |
string |
状态结束时间。 |
2024-07-10T11:49:47Z |
| ReasonCode |
string |
状态码。 |
TrainingJobSucceed |
| ReasonMessage |
string |
状态更新信息。 |
KubeDL job runs successfully |
| StartTime |
string |
状态开始时间。 |
2024-07-10T11:49:47Z |
| Status |
string |
训练任务状态。 |
Creating |
| TrainingJobDescription |
string |
训练任务描述。 |
Qwen2 large language model training. |
| UserId |
string |
用户 ID。 |
123456789 |
| AlgorithmVersion |
string |
算法版本。 |
v0.0.1 |
| LatestMetrics |
array<object> |
训练任务指标列表。 |
|
|
object |
训练任务监控指标。 |
||
| Name |
string |
指标名。 |
loss |
| Timestamp |
string |
指标收集时间。 |
2024-07-10T11:49:47Z |
| Value |
number |
指标值。 |
0.11 |
| GmtCreateTime |
string |
训练任务创建时间。 |
2024-07-10T11:49:47Z |
| RequestId |
string |
请求 ID。 |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
| Instances |
array<object> |
训练任务实例列表。 |
|
|
object |
训练任务实例。 |
||
| Name |
string |
实例名。 |
train1oug3yehan4-master-0 |
| Role |
string |
实例角色。 |
master |
| Status |
string |
实例状态。 |
Succeeded |
| AlgorithmId |
string |
训练算法 ID。 |
algo-xsldfvu1334 |
| TrainingJobUrl |
string |
训练任务详情地址。 |
https://pai.console.aliyun.com/?regionId=cn-hangzhou&workspaceId=1234#/training/jobs/train1ouyadsl8n4 |
| RoleArn |
string |
代理授权使用的角色信息。 |
acs:ram::{accountID}:role/{roleName} |
| AlgorithmSpec | AlgorithmSpec |
临时算法定义。 |
|
| IsTempAlgo |
boolean |
是否使用了临时算法。 |
true |
| LatestProgress |
object |
训练任务进度的最新值。 |
|
| OverallProgress |
object |
训练任务执行的总体进度。 |
|
| Timestamp |
string |
进度时间。 |
2023-07-04T13:20:18Z |
| Value |
number |
进度值。 |
0.75 |
| RemainingTime |
object |
训练任务执行的预估剩余时间(单位秒)。 |
|
| Timestamp |
string |
进度时间。 |
2023-07-04T13:20:18Z |
| Value |
integer |
剩余时间(单位秒)。 |
3600 |
| UserVpc |
object |
用户 VPC 配置。 |
|
| VpcId |
string |
VPC ID。 |
vpc-abcdef**** |
| SwitchId |
string |
交换机 ID。 |
vs-abcdef**** |
| SecurityGroupId |
string |
安全组 ID。 |
sg-abcdef**** |
| ExtendedCIDRs |
array |
扩展网段配置。 |
|
|
string |
扩展网段配置。 |
192.168.0.1/24 |
|
| OutputModel |
object |
训练任务产出的模型。 |
|
| Uri |
string |
模型地址。 |
oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/model/output/ |
| OutputChannelName |
string |
模型对应的 OutputChannel 名。 |
model |
| Settings | JobSettings |
训练任务额外参数配置。 |
|
| ExperimentConfig |
object |
训练任务关联实验配置。 |
|
| ExperimentId |
string |
训练任务关联实验 ID。 |
exp-ds9aefia90v |
| ExperimentName |
string |
训练任务关联实验名。 |
large_language_model_train |
| Duration |
integer |
训练任务运行时长。单位:秒。 |
7200 |
| Environments |
object |
训练任务环境变量。 |
|
|
string |
训练任务环境变量。 |
debug=true |
|
| PythonRequirements |
array |
训练任务 Python 包配置。 |
|
|
string |
训练任务 Python 包配置。 |
torch>=2.2.0 |
|
| Priority |
integer |
任务优先级。 |
0 |
| AssignNodeSpec |
AssignNodeSpec |
||
| CredentialConfig |
CredentialConfig |
示例
正常返回示例
JSON格式
{
"OutputChannels": [
{
"Name": "model",
"OutputUri": "oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/output/model/",
"DatasetId": "d-8o0hh35po15ejcdq2p",
"VersionName": "v1",
"RoleArn": ""
}
],
"Status": "Running",
"HyperParameters": [
{
"Name": "learning_rate",
"Value": "0.0001"
}
],
"TrainingJobName": "qwen_llm",
"TrainingJobId": "traini6hhxiq69eo",
"Scheduler": {
"MaxRunningTimeInSeconds": "0",
"MaxRunningTimeInMinutes": "100"
},
"ReasonMessage": "None",
"WorkspaceId": "86995",
"ComputeResource": {
"EcsCount": 1,
"EcsSpec": "ecs.gn5-c8g1.2xlarge",
"ResourceId": "quotam670lixikcl",
"ResourceName": "quota",
"InstanceCount": 1,
"InstanceSpec": {
"CPU": "8",
"Memory": "32",
"SharedMemory": "32",
"GPU": "1",
"GPUType": "V100"
},
"UseSpotInstance": true,
"SpotSpec": {
"SpotStrategy": "SpotWithPriceLimit",
"SpotDiscountLimit": 0.9
}
},
"Labels": [
{
"Key": "CreatedBy",
"Value": "QuickStart"
}
],
"AlgorithmProvider": "pai",
"InputChannels": [
{
"DatasetId": "d-475megosidivjfgfq6",
"Name": "model",
"InputUri": "oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/input/model/",
"Options": "ossAppendable=true",
"VersionName": "v1",
"RoleArn": ""
}
],
"AlgorithmName": "llm_training",
"ReasonCode": "TrainingJobSucceed",
"GmtModifiedTime": "2024-07-10T11:49:47Z",
"StatusTransitions": [
{
"EndTime": "2024-07-10T11:49:47Z",
"ReasonCode": "TrainingJobSucceed",
"ReasonMessage": "KubeDL job runs successfully",
"StartTime": "2024-07-10T11:49:47Z",
"Status": "Creating"
}
],
"TrainingJobDescription": "Qwen2 large language model training.",
"UserId": "123456789",
"AlgorithmVersion": "v0.0.1",
"LatestMetrics": [
{
"Name": "loss",
"Timestamp": "2024-07-10T11:49:47Z",
"Value": 0.11
}
],
"GmtCreateTime": "2024-07-10T11:49:47Z",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
"Instances": [
{
"Name": "train1oug3yehan4-master-0",
"Role": "master",
"Status": "Succeeded"
}
],
"AlgorithmId": "algo-xsldfvu1334",
"TrainingJobUrl": "https://pai.console.aliyun.com/?regionId=cn-hangzhou&workspaceId=1234#/training/jobs/train1ouyadsl8n4",
"RoleArn": "acs:ram::{accountID}:role/{roleName}",
"AlgorithmSpec": {
"OutputChannels": [
{
"Description": "模型输出。",
"Required": true,
"Properties": {},
"Name": "Model",
"SupportedChannelTypes": [
"oss"
]
}
],
"HyperParameters": [
{
"DefaultValue": "0",
"Type": "Integer",
"Description": "参数定义了训练的batch_size。",
"Required": true,
"Name": "batch_size",
"Range": {
"Enum": [
"0"
],
"MinLength": 1,
"MaxLength": 30,
"Minimum": "0",
"Maximum": "10",
"ExclusiveMinimum": true,
"ExclusiveMaximum": true,
"Pattern": "^\\+?[1-9][0-9]*$"
},
"DisplayName": "Batch Size"
}
],
"JobType": "TFJob",
"Command": [
"python train.py"
],
"MetricDefinitions": [
{
"Description": "训练损失函数。",
"Regex": ".*train:loss=([-+]?[0-9]*\\\\.?[0-9]+(?:[eE][-+]?[0-9]+)?).*",
"Name": "loss"
}
],
"InputChannels": [
{
"Description": "模型输出。",
"Required": true,
"Properties": {},
"Name": "Model",
"SupportedChannelTypes": [
"oss"
]
}
],
"SupportsDistributedTraining": true,
"Image": "registry.cn-shanghai.aliyuncs.com/pai-training/kmeans:v1.0.0",
"SupportedInstanceTypes": [
"ecs.g6.2xlarge"
],
"ComputeResource": {
"Policy": {
"Version": "V1",
"Value": "[{\\\"MinTotalCount\\\":1,\\\"MaxTotalCount\\\":4,\\\"RolePolicies\\\":{\\\"chief\\\":{\\\"Count\\\":1},\\\"ps\\\":{\\\"Count\\\":1},\\\"worker\\\":{\\\"Percentage\\\":100}}},{\\\"MinTotalCount\\\":5,\\\"MaxTotalCount\\\":10,\\\"RolePolicies\\\":{\\\"chief\\\":{\\\"Count\\\":1},\\\"ps\\\":{\\\"Percentage\\\":20},\\\"worker\\\":{\\\"Percentage\\\":80}}},{\\\"MinTotalCount\\\":11,\\\"RolePolicies\\\":{\\\"chief\\\":{\\\"Count\\\":1},\\\"ps\\\":{\\\"Percentage\\\":40},\\\"worker\\\":{\\\"Percentage\\\":60}}}]"
}
},
"CodeDir": {
"LocationType": "OSS",
"LocationValue": {
"test": "test",
"test2": 1
}
},
"Customization": {
"CodeDir": true
},
"ResourceRequirements": [
{
"Key": "SupportedMachineTypes",
"Operator": "in",
"Values": [
"ecs.gn5-c4g1.xlarge"
]
}
],
"ProgressDefinitions": {
"OverallProgress": {
"Description": "training progress",
"Regex": "^[0-9]+([.][0-9]+){0,1}$"
},
"RemainingTime": {
"Description": "training remaining time",
"Regex": "^[0-9]+([.][0-9]+){0,1}$"
}
}
},
"IsTempAlgo": true,
"LatestProgress": {
"OverallProgress": {
"Timestamp": "2023-07-04T13:20:18Z",
"Value": 0.75
},
"RemainingTime": {
"Timestamp": "2023-07-04T13:20:18Z",
"Value": 3600
}
},
"UserVpc": {
"VpcId": "vpc-abcdef****",
"SwitchId": "vs-abcdef****",
"SecurityGroupId": "sg-abcdef****",
"ExtendedCIDRs": [
"192.168.0.1/24"
]
},
"OutputModel": {
"Uri": "oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/model/output/",
"OutputChannelName": "model"
},
"Settings": {
"BusinessUserId": "166924",
"Caller": "SilkFlow",
"Tags": {
"key": ""
},
"PipelineId": "pid-123456",
"EnableTideResource": true,
"EnableErrorMonitoringInAIMaster": false,
"ErrorMonitoringArgs": "--enable-log-hang-detection true",
"EnableRDMA": true,
"EnableOssAppend": true,
"OversoldType": "AcceptQuotaOverSold",
"AdvancedSettings": {
"test": "test",
"test2": 1
},
"Driver": "535.54.03",
"EnableSanityCheck": true,
"SanityCheckArgs": "--sanity-check-timing=AfterJobFaultTolerant --sanity-check-timeout-ops=MarkJobFai",
"JobReservedMinutes": 30,
"JobReservedPolicy": "Always"
},
"ExperimentConfig": {
"ExperimentId": "exp-ds9aefia90v",
"ExperimentName": "large_language_model_train"
},
"Duration": 7200,
"Environments": {
"key": "debug=true"
},
"PythonRequirements": [
"torch>=2.2.0"
],
"Priority": 0,
"AssignNodeSpec": {
"EnableAssignNode": true,
"NodeNames": "",
"AntiAffinityNodeNames": ""
},
"CredentialConfig": {
"EnableCredentialInject": true,
"AliyunEnvRoleKey": "",
"CredentialConfigItems": [
{
"Key": "",
"Type": "",
"Roles": [
{
"RoleArn": "",
"RoleType": "",
"AssumeRoleFor": "",
"Policy": "",
"AssumeUserInfo": {
"SecurityToken": "",
"AccessKeyId": "",
"Type": "",
"Id": ""
}
}
]
}
]
}
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。