查詢、取消、刪除調優任務,以及查詢調優任務日誌。
適用範圍
- 適用地區:本文描述的功能僅在華北2(北京)地區可用,且必須使用該地區的API Key。
- 適用地區:本文描述的功能僅在新加坡地區可用,且必須使用該地區的API Key。
- 已成功擷取 API Key並配置到環境變數。
- 已通過建立調優任務介面建立了調優任務。
查詢調優任務狀態
查詢指定調優任務的詳細資料和運行狀態。
地址
GET https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/{job_id}
請求樣本
curl --location --request GET "https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/<替換為您的調優任務id>" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json'
請求參數
欄位 | 類型 | 傳參方式 | 必選 | 描述 |
|---|---|---|---|---|
job_id | String | Url Path | 是 | 要查詢的調優任務的ID。即建立調優任務返回參數中的job_id。 |
響應樣本
文本產生模型
{
"request_id": "c59b2145-a93c-4e00-b610-4d7cc5c521a2",
"output": {
"job_id": "ft-202410291653-1c7f",
"job_name": "ft-202410291653-1c7f",
"status": "SUCCEEDED",
"finetuned_output": "qwen3-14b-suffix-ft-202410291653-1c7f",
"model": "qwen3-14b",
"base_model": "qwen3-14b",
"training_file_ids": [],
"validation_file_ids": [],
"training_datasets": [
{
"data_source_type": "file_id",
"file_id": "976bd01a-f30b-4414-86fd-50c54486e3ef"
}
],
"validation_datasets": [],
"hyper_parameters": {
"n_epochs": 3,
"batch_size": 32,
"max_length": 8192,
"learning_rate": "1.6e-5",
"lr_scheduler_type": "linear",
"split": 0.9
},
"training_type": "sft",
"create_time": "2024-10-29 16:53:53",
"workspace_id": "llm-v71tlv***",
"user_identity": "1396993924585947",
"modifier": "1396993924585947",
"creator": "1396993924585947",
"end_time": "2024-10-29 17:11:26",
"group": "llm",
"usage": 279808
}
}
視頻產生模型
關注 output.status(SUCCEEDED 表示訓練完成)和 output.usage(訓練消耗的總 Token 數量)。
{
"request_id": "9bbb953c-bef2-4b59-9fc5-xxxxxxxxx",
"output": {
"job_id": "ft-202511111122-xxxx",
"status": "SUCCEEDED",
"finetuned_output": "wan2.5-i2v-preview-ft-202511111122-xxxx",
"model": "wan2.5-i2v-preview",
"base_model": "wan2.5-i2v-preview",
"training_file_ids": [],
"validation_file_ids": [],
"training_datasets": [
{
"data_source_type": "file_id",
"file_id": "xxxxxxxxxxxx"
}
],
"validation_datasets": [],
"hyper_parameters": {
"n_epochs": 400,
"learning_rate": 2e-05,
"split": 0.9,
"eval_epochs": 50
},
"training_type": "efficient_sft",
"create_time": "2025-11-11 11:22:22",
"end_time": "2025-11-11 16:49:01",
"usage": 432000,
"output_cnt": 8
}
}
映像產生模型
{
"request_id": "03d738f5-3720-90b0-9c7b-xxxxxxxxx",
"output": {
"job_id": "ft-202606030110-xxxx",
"status": "SUCCEEDED",
"finetuned_output": "wan2.7-image-pro-ft-202606030110-xxxx",
"model": "wan2.7-image-pro",
"base_model": "wan2.7-image-pro",
"training_file_ids": [],
"validation_file_ids": [],
"training_datasets": [
{
"data_source_type": "file_id",
"file_id": "xxxxxxxxxxxx"
}
],
"validation_datasets": [],
"hyper_parameters": {
"max_steps": 800,
"learning_rate": 3e-05,
"eval_steps": 200,
"max_token_length": "2k",
"max_pixels": "2k",
"val_img_size": "2k",
"generation_type": "t2i",
"lora_rank": 32
},
"training_type": "efficient_sft",
"create_time": "2026-06-03 01:10:47",
"end_time": "2026-06-03 01:38:53",
"usage": 10273216,
"output_cnt": 1
}
}
響應參數
參數名稱 | 類型 | 參數說明 |
|---|---|---|
request_id | String | 本次請求的ID。 |
output | Object | 調優任務的詳細資料。 |
output.job_id | String | 本次調優的任務ID,用於後續查詢狀態。 建置規則: |
output.jobs_name | String | 同 |
output.status | String | 本次調優任務的狀態。 |
output.finetuned_output | String | 僅調優任務狀態為“SUCCEED”時出現,返回的是調優完成的模型ID。 |
output.model | String | 調優任務使用的模型ID。 |
output.base_model | String | 調優任務使用的模型對應的基本模型ID。 比如:調優任務 |
output.training_file_ids | Array | 相容欄位,新任務始終返回空數組,請使用 training_datasets。 |
output.validation_file_ids | Array | 相容欄位,新任務始終返回空數組,請使用 validation_datasets。 |
output.training_datasets | Array of Dataset | 訓練資料集列表。 |
output.validation_datasets | Array of Dataset | 測試資料集列表。 |
output.hyper_parameters | Object | 顯性聲明過的超參表。 |
output.training_type | String | 調優方法。 |
output.create_time | String | 調優任務建立時間。 |
output.workspace_id | String | 調優任務所屬的業務空間ID。 |
output.user_identity | String | 該調優任務隸屬的主帳號UID。 |
output.modifier | String | 對該調優任務進行最後一次操作的帳號UID。(比如:某個子帳號取消了該任務,該子帳號UID會顯示在這裡) |
output.creator | String | 該調優任務建立人UID。 |
output.end_time | String | 調優任務結束時間,當任務狀態為“SUCCEED”、“FAILED”、“CANCELED”時出現。 |
output.group | String | 模型調優的任務類型。 |
output.usage | Integer | 調優任務消耗的Token(count)數,計費計算公式請參考:計費說明。當任務狀態為“SUCCEED”、“CANCELED”時出現。 |
output.output_cnt | Integer | 當前任務已產出的 Checkpoint 數量。僅對支援多 Checkpoint 輸出的模型(如 |
output.max_output_cnt | Integer | 單次任務可產出的 Checkpoint 數量上限。 |
取消調優任務
取消正在啟動並執行調優任務。僅處於運行中狀態的任務可被取消。
地址
POST https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/{job_id}/cancel
請求樣本
curl --location --request POST "https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/<替換為您的調優任務id>/cancel" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json'
請求參數
欄位 | 類型 | 傳參方式 | 必選 | 描述 |
|---|---|---|---|---|
job_id | String | Url Path | 是 | 要取消的調優任務ID,可通過建立訓練任務或列舉訓練任務介面擷取。 |
響應樣本
{
"request_id": "670fca9d-48dd-4c5a-83e7-33bcc20420f8",
"output": {
"status": "success"
}
}
響應參數
參數名稱 | 類型 | 參數說明 |
|---|---|---|
request_id | String | 本次請求的ID。 |
output | Object | 取消操作返回的詳細資料。 |
刪除調優任務
刪除指定的調優任務記錄。
地址
DELETE https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/{job_id}
請求樣本
curl --location --request DELETE "https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/<替換為您的調優任務id>" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json'
請求參數
欄位 | 類型 | 傳參方式 | 必選 | 描述 |
|---|---|---|---|---|
job_id | String | Url Path | 是 | 要刪除的調優任務ID,可通過建立訓練任務或列舉訓練任務介面擷取。 |
響應樣本
{
"request_id": "7d7e1469-df77-4163-83ce-54425df744ed",
"output": {
"status": "success"
}
}
響應參數
參數名稱 | 類型 | 參數說明 |
|---|---|---|
request_id | String | 本次請求的ID。 |
output | Object | 刪除操作返回的詳細資料。 |
查詢調優工作清單
分頁查詢當前帳號下的調優工作清單。
地址
GET https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes
請求樣本
curl --location --request GET "https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes?model=qwen3-14b&page_no=2" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json'
請求參數
參數名稱 | 類型 | 傳參方式 | 是否必填 | 參數說明 |
|---|---|---|---|---|
page_no | Integer | Query | 否 | 預設1 |
page_size | Integer | Query | 否 | 預設10,最大值1000,最小值1 |
model | String | Query | 否 | 模型ID,指定該參數表示只列舉基於該模型的調優任務 |
響應樣本
{
"request_id": "2182ef64-6398-457b-b3f6-5fde5fd6b388",
"output": {
"page_no": 2,
"page_size": 10,
"total": 12,
"jobs": [
{
"job_id": "ft-202410291653-1c7f",
"job_name": "ft-202410291653-1c7f",
"status": "SUCCEEDED",
"finetuned_output": "qwen3-14b-suffix-ft-202410291653-1c7f",
"model": "qwen3-14b",
"base_model": "qwen3-14b",
"training_file_ids": [],
"validation_file_ids": [],
"training_datasets": [
{
"data_source_type": "file_id",
"file_id": "976bd01a-f30b-4414-86fd-50c54486e3ef"
}
],
"validation_datasets": [],
"hyper_parameters": {
"n_epochs": 3,
"batch_size": 32,
"max_length": 8192,
"learning_rate": "1.6e-5",
"lr_scheduler_type": "linear",
"split": 0.9
},
"training_type": "sft",
"create_time": "2024-10-29 16:53:53",
"workspace_id": "llm-v71tlv***",
"user_identity": "1396993924585947",
"modifier": "1396993924585947",
"creator": "1396993924585947",
"end_time": "2024-10-29 17:11:26",
"group": "llm",
"usage": 279808
},
{
"job_id": "ft-202410291512-1851",
"job_name": "ft-202410291512-1851",
"status": "CANCELED",
"model": "qwen3-14b",
"base_model": "qwen3-14b",
"training_file_ids": [],
"validation_file_ids": [],
"training_datasets": [
{
"data_source_type": "file_id",
"file_id": "86a9fe7f-dd77-43b0-9834-2170e12339ec"
},
{
"data_source_type": "file_id",
"file_id": "03ead352-6190-4328-8016-61821c23d4fc"
}
],
"validation_datasets": [],
"hyper_parameters": {
"n_epochs": 3,
"batch_size": 32,
"max_length": 8192,
"learning_rate": "1.6e-5",
"lr_scheduler_type": "linear",
"split": 0.9
},
"code": "1",
"training_type": "sft",
"create_time": "2024-10-29 15:12:00",
"workspace_id": "llm-v71tlv***",
"user_identity": "1396993924585947",
"modifier": "1396993924585947",
"creator": "1396993924585947",
"end_time": "2024-10-29 15:16:00",
"group": "llm",
"usage": 0
}
]
}
}
響應參數
| 參數名稱 | 類型 | 參數說明 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request_id | String | 本次請求的ID。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
output | Object | 查詢返回的詳細資料。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
output.page_no | Integer | 頁碼。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
output.page_size | Integer | 每頁顯示的資料量。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
output.total | Integer | 調優任務總計數量。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
output.jobs | Array | 多個調優任務詳情。 點擊此處查看調優任務詳情對象
|
查詢調優任務日誌
查詢指定調優任務的訓練日誌。
地址
GET https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/{job_id}/logs
請求樣本
curl --location --request GET "https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/<替換為您的調優任務id>/logs?offset=10&line=10" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json'
請求參數
欄位 | 類型 | 傳參方式 | 必選 | 描述 |
|---|---|---|---|---|
job_id | String | Url Path | 是 | 要列印日誌的調優任務ID,可通過建立訓練任務或列舉訓練任務介面擷取。 |
offset | Number | Query | 否 | 忽略前 |
line | Number | Query | 否 | 從 |
響應樣本
{
"request_id": "ce49b45d-fe46-474e-9e1b-3e7427ffdf5a",
"output": {
"total": 20,
"logs": [
"{'train_runtime': 216.3999, 'train_samples_per_second': 2.066, 'train_steps_per_second': 0.014, 'train_loss': 0.9122632344563802, 'epoch': 0.8571428571428571}",
" Actual number of consumed tokens is 279808!",
" Uploaded checkpoint!",
" Fine-tune succeeded!",
" use checkpoint-3 as final checkpoint",
"2024-10-29 17:03:47,719 - INFO - transfer for inference succeeded, start to deliver it for inference",
"2024-10-29 17:09:43,322 - INFO - start to save checkpoint",
"2024-10-29 17:11:24,689 - INFO - finetune-job succeeded",
"2024-10-29 17:11:25,130 - INFO - training usage 279808",
"2024-10-29 17:11:25,175 - INFO - ##FT_COMPLETE##"
]
}
}
響應參數
參數名稱 | 類型 | 參數說明 |
|---|---|---|
request_id | String | 本次請求的ID。 |
output | Object | 查詢返回的詳細資料。 |
output.total | Integer | 日誌合計列數。 |
output.logs | Array | 輸出的日誌。 |
異常響應
響應樣本
{
"code": "NotFound",
"request_id": "BE213CDD-8A5C-59EE-9A67-055EAB0CB59B",
"message": "Not Found!"
}
響應參數
欄位 | 類型 | 描述 | 樣本值 |
|---|---|---|---|
code | String | 錯誤碼。 | NotFound |
request_id | String | 本次請求的系統唯一碼。 | 6332fb02-3111-43f0-bf79-f9e8c5ffa7f9 |
message | String | 錯誤資訊。 | Not Found! |
當請求出錯時,可能返回以下錯誤:
HTTP狀態代碼 | 錯誤碼 | 錯誤資訊舉例 | 含義 | 處理方式 |
|---|---|---|---|---|
400 | InvalidParameter | Missing training files | 參數錯誤,缺少參數或者參數格式問題等。 | 根據錯誤資訊,修正您的參數。 |
400 | UnsupportedOperation | The fine-tune job can not be canceled because it is succeeded or failed | 當資源處於特定狀態時,無法對其進行操作。 | 待要操作的資源到達可操作狀態時再進行操作。 |
400 | UnsupportedOperation | The fine-tune job can not be deleted because it is succeeded,failed or canceled | 當資源處於特定狀態時,無法對其進行操作。 | 待要操作的資源到達可操作狀態時再進行操作。 |
404 | NotFound | Not found! | 要查詢/操作的資源不存在。 | 檢查要查詢/操作的資源ID是否錯誤。 |
409 | Conflict | Model instance xxxxx already exists, please specify a suffix | 已存在deployed_model名為xxxxx的部署執行個體,需要指定尾碼進行區分。 | 為部署指定唯一的尾碼。 |
429 | Throttling |
| 資源的建立觸發平台限制。 |
|
500 | InternalError | Internal server error! | 內部錯誤。 | 記錄 request_id,通過工單聯絡阿里雲工程師進行排查。 |