Skip to content

Commit 60b9a2f

Browse files
committed
feat: add model compress command & decision model inference
1 parent fd8967f commit 60b9a2f

50 files changed

Lines changed: 3408 additions & 94 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,22 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
66

77
[中文版](CHANGELOG.zh.md) · [README](README.md) · [Contributing](CONTRIBUTING.md)
88

9+
## [Unreleased]
10+
11+
### Added
12+
13+
- **Decision model inference** — Added `bl decision` for TypeSafe System One requests against workspace-scoped endpoints, including `choice` / `noul` / `score` validation, JSON and text output, training-sample reuse, Beijing/Singapore routing, and dry-run previews.
14+
15+
### Changed
16+
17+
- **Decision dataset validation** — Aligned the `decision` schema with the current API: `state` may be a string, object, or array; `instructions` is optional; and question criteria now enforce API limits.
18+
919
## [2.2.0] - 2026-10-12
1020

21+
### Added
22+
23+
- **Model compression lifecycle** — Added `bl finetune compress templates/create/list/get/watch/logs/cancel/delete` for quantizing supported full-parameter fine-tuned models, including dry-run previews, status polling, log retrieval, and safe deletion confirmation.
24+
1125
### Changed
1226

1327
- **Token Plan usage window** — `bl usage token-plan` now reports a single monthly quota (usage percentage and reset time) instead of the previous 5-hour and 1-week windows.

‎CHANGELOG.zh.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,22 @@
66

77
[English](CHANGELOG.md) · [README](README.zh.md) · [参与贡献](CONTRIBUTING.zh.md)
88

9+
## [未发布]
10+
11+
### 新增
12+
13+
- **决策模型推理** —— 新增 `bl decision`,通过工作空间专属 Endpoint 调用 TypeSafe System One,支持 `choice` / `noul` / `score` 校验、JSON 与文本输出、复用训练样本、北京/新加坡地域路由及 dry-run 预览。
14+
15+
### 变更
16+
17+
- **决策数据集校验** —— 与最新 API 对齐:`state` 可为字符串、对象或数组,`instructions` 改为可选,并按接口限制校验各类问题的 criteria。
18+
919
## [2.2.0] - 2026-10-12
1020

21+
### 新增
22+
23+
- **模型压缩完整生命周期** —— 新增 `bl finetune compress templates/create/list/get/watch/logs/cancel/delete`,支持对符合条件的全参调优模型执行量化压缩,并覆盖 dry-run 预览、状态轮询、日志查询和安全删除确认。
24+
1125
### 变更
1226

1327
- **Token Plan 额度窗口** —— `bl usage token-plan` 现在只展示月度额度(使用百分比与重置时间),不再显示此前的 5 小时和 1 周窗口。

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ Once installed, just describe your task to your AI Agent — no need to assemble
121121
| Monitoring & alerts | "Show my model call stats, failures and logs, and create an alert rule." |
122122
| Throughput reservations | "List my throughput reservations and capacity instances, then scale, renew or release capacity and wait for the operation to finish." |
123123
| Model selection | "Recommend a model for image understanding and customer support." |
124+
| Decision model | "Use the Bailian decision model to route this ticket and assess whether it needs escalation." |
124125
| About Bailian CLI | "Tell me what Bailian CLI can do for me, and suggest how to use it for my needs." |
125126

126127
> More examples and scenarios: [Aliyun Model Studio CLI Site](https://bailian.console.aliyun.com/cli?source_channel=cli_github&)

‎README.zh.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ irm https://bailian.aliyun.com/cli/install.ps1 | iex
120120
| 监控与告警 | “查看我的模型调用统计、失败明细和调用日志,并创建一条告警规则。” |
121121
| 吞吐预留 | “查看我的吞吐预留及容量实例,并对容量进行扩缩、续订或释放,再等待操作完成。” |
122122
| 模型选型 | “推荐一个适合图片理解和智能客服的模型。” |
123+
| 决策模型 | “用百炼决策模型给这张工单分流,并判断是否需要升级处理。” |
123124
| 了解 Bailian CLI | “介绍一下 Bailian CLI 能帮我完成哪些任务,并根据我的需求推荐使用方式。” |
124125

125126
> 更多案例与使用场景:[阿里云百炼 CLI 官方主页](https://bailian.console.aliyun.com/cli?source_channel=cli_github&)

‎packages/cli/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ Once installed, just describe your task to your AI Agent — no need to assemble
121121
| Monitoring & alerts | "Show my model call stats, failures and logs, and create an alert rule." |
122122
| Throughput reservations | "List my throughput reservations and capacity instances, then scale, renew or release capacity and wait for the operation to finish." |
123123
| Model selection | "Recommend a model for image understanding and customer support." |
124+
| Decision model | "Use the Bailian decision model to route this ticket and assess whether it needs escalation." |
124125
| About Bailian CLI | "Tell me what Bailian CLI can do for me, and suggest how to use it for my needs." |
125126

126127
> More examples and scenarios: [Aliyun Model Studio CLI Site](https://bailian.console.aliyun.com/cli?source_channel=cli_github&)

‎packages/cli/README.zh.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ irm https://bailian.aliyun.com/cli/install.ps1 | iex
120120
| 监控与告警 | “查看我的模型调用统计、失败明细和调用日志,并创建一条告警规则。” |
121121
| 吞吐预留 | “查看我的吞吐预留及容量实例,并对容量进行扩缩、续订或释放,再等待操作完成。” |
122122
| 模型选型 | “推荐一个适合图片理解和智能客服的模型。” |
123+
| 决策模型 | “用百炼决策模型给这张工单分流,并判断是否需要升级处理。” |
123124
| 了解 Bailian CLI | “介绍一下 Bailian CLI 能帮我完成哪些任务,并根据我的需求推荐使用方式。” |
124125

125126
> 更多案例与使用场景:[阿里云百炼 CLI 官方主页](https://bailian.console.aliyun.com/cli?source_channel=cli_github&)

‎packages/cli/src/commands.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
videoTaskGet,
1515
videoDownload,
1616
visionDescribe,
17+
decisionPredict,
1718
configShow,
1819
configSet,
1920
configList,
@@ -154,6 +155,14 @@ import {
154155
finetuneWatch,
155156
finetuneCapability,
156157
finetunePrice,
158+
finetuneCompressTemplates,
159+
finetuneCompressCreate,
160+
finetuneCompressList,
161+
finetuneCompressGet,
162+
finetuneCompressWatch,
163+
finetuneCompressLogs,
164+
finetuneCompressCancel,
165+
finetuneCompressDelete,
157166
deployTextCreate,
158167
deployAudioCreate,
159168
deployImageCreate,
@@ -298,6 +307,7 @@ export const commands: Record<string, AnyCommand> = {
298307
"video task get": videoTaskGet,
299308
"video download": videoDownload,
300309
"vision describe": visionDescribe,
310+
decision: decisionPredict,
301311
"config show": configShow,
302312
"config set": configSet,
303313
"config list": configList,
@@ -440,6 +450,14 @@ export const commands: Record<string, AnyCommand> = {
440450
"finetune watch": finetuneWatch,
441451
"finetune capability": finetuneCapability,
442452
"finetune price": finetunePrice,
453+
"finetune compress templates": finetuneCompressTemplates,
454+
"finetune compress create": finetuneCompressCreate,
455+
"finetune compress list": finetuneCompressList,
456+
"finetune compress get": finetuneCompressGet,
457+
"finetune compress watch": finetuneCompressWatch,
458+
"finetune compress logs": finetuneCompressLogs,
459+
"finetune compress cancel": finetuneCompressCancel,
460+
"finetune compress delete": finetuneCompressDelete,
443461
"deploy text create": deployTextCreate,
444462
"deploy audio create": deployAudioCreate,
445463
"deploy image create": deployImageCreate,

‎packages/commands/src/commands/dataset/upload.ts‎

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
formatIssue,
77
MAX_DATASET_BYTES,
88
MAX_CPT_BYTES,
9+
MAX_DECISION_DATASET_BYTES,
910
MAX_MEDIA_ZIP_BYTES,
1011
BailianError,
1112
ExitCode,
@@ -18,9 +19,10 @@ const UPLOAD_FLAGS = {
1819
type: "string",
1920
valueHint: "<path>",
2021
description: {
21-
"en-US": "Local dataset file (.jsonl or .zip; ≤200MB SFT/DPO, ≤300MB CPT, ≤2GB media zip)",
22+
"en-US":
23+
"Local dataset file (.jsonl or .zip; ≤200MB SFT/DPO, ≤300MB CPT/decision, ≤2GB media zip)",
2224
"zh-CN":
23-
"本地数据集文件(.jsonl 或 .zip;SFT/DPO 不超过 200MB,CPT 不超过 300MB,媒体 ZIP 不超过 2GB)",
25+
"本地数据集文件(.jsonl 或 .zip;SFT/DPO 不超过 200MB,CPT/决策模型不超过 300MB,媒体 ZIP 不超过 2GB)",
2426
},
2527
required: true,
2628
},
@@ -37,9 +39,9 @@ const UPLOAD_FLAGS = {
3739
valueHint: "<s>",
3840
description: {
3941
"en-US":
40-
'Record schema: "chatml" (SFT), "dpo" (chosen/rejected), "cpt" (raw text), "tts" (audio), "image" (image generation), or "video" (video generation). Default auto-detects per record.',
42+
'Record schema: "chatml" (SFT), "dpo" (chosen/rejected), "cpt" (raw text), "decision" (state/questions), "tts" (audio), "image" (image generation), or "video" (video generation). Default auto-detects per record.',
4143
"zh-CN":
42-
'记录 Schema:"chatml"(SFT)、"dpo"(chosen/rejected)、"cpt"(原始文本)、"tts"(音频)、"image"(图片生成)或 "video"(视频生成)。默认逐条自动识别。',
44+
'记录 Schema:"chatml"(SFT)、"dpo"(chosen/rejected)、"cpt"(原始文本)、"decision"(state/questions 决策数据)、"tts"(音频)、"image"(图片生成)或 "video"(视频生成)。默认逐条自动识别。',
4345
},
4446
},
4547
noValidate: {
@@ -65,12 +67,13 @@ export default defineCommand({
6567
},
6668
auth: "apiKey",
6769
usageArgs:
68-
"--file <path> [--purpose <name>] [--schema <chatml|dpo|cpt|tts|image|video>] [--no-validate] [--full-validate]",
70+
"--file <path> [--purpose <name>] [--schema <chatml|dpo|cpt|decision|tts|image|video>] [--no-validate] [--full-validate]",
6971
flags: UPLOAD_FLAGS,
7072
exampleArgs: [
7173
"--file train.jsonl",
7274
"--file dpo.jsonl --schema dpo",
7375
"--file cpt.jsonl --schema cpt",
76+
"--file decision.jsonl --schema decision",
7477
"--file audio.zip --schema tts",
7578
"--file eval.jsonl --purpose evaluation",
7679
"--file train.jsonl --full-validate",
@@ -79,35 +82,37 @@ export default defineCommand({
7982
notes: [
8083
{
8184
"en-US":
82-
'Supports .jsonl (text) and .zip (audio/image/video archives with a data.jsonl manifest). Six record schemas are recognized: chatml = {messages:[...]} (SFT); dpo = {messages:[...], chosen, rejected}; cpt = {text:"..."} (continual pre-training, raw text); tts = {wav_fn:"train/xxx.wav", text:"..."} (audio fine-tuning); image = {img_path:"..."} (image generation); video = {first_frame_path:...} (video generation).',
85+
'Supports .jsonl (text/decision) and .zip (audio/image/video archives with a data.jsonl manifest). Seven record schemas are recognized: chatml = {messages:[...]} (SFT); dpo = {messages:[...], chosen, rejected}; cpt = {text:"..."}; decision = {state:{content}, questions:{...}}; tts = {wav_fn:"train/xxx.wav", text:"..."}; image = {img_path:"..."}; video = {first_frame_path:...}.',
8386
"zh-CN":
84-
'支持 .jsonl(文本)和 .zip(包含 data.jsonl 清单的音频、图片或视频归档)。可识别六种记录 Schema:chatml = {messages:[...]}(SFT);dpo = {messages:[...], chosen, rejected};cpt = {text:"..."}(持续预训练,原始文本);tts = {wav_fn:"train/xxx.wav", text:"..."}(音频微调);image = {img_path:"..."}(图片生成);video = {first_frame_path:...}(视频生成)。',
87+
'支持 .jsonl(文本/决策)和 .zip(包含 data.jsonl 清单的音频、图片或视频归档)。可识别七种记录 Schema:chatml = {messages:[...]}(SFT);dpo = {messages:[...], chosen, rejected};cpt = {text:"..."};decision = {state:{content}, questions:{...}};tts = {wav_fn:"train/xxx.wav", text:"..."};image = {img_path:"..."};video = {first_frame_path:...}。',
8588
},
8689
{
8790
"en-US":
88-
"With no --schema, a record carrying wav_fn is validated as TTS, img_path as image, chosen/rejected as DPO, text (no messages) as CPT, otherwise ChatML.",
91+
"With no --schema, state/questions is validated as decision data, wav_fn as TTS, img_path as image, chosen/rejected as DPO, text (no messages) as CPT, otherwise ChatML.",
8992
"zh-CN":
90-
"未指定 --schema 时,包含 wav_fn 的记录按 TTS 验证,包含 img_path 的按 image 验证,包含 chosen/rejected 的按 DPO 验证,仅含 text(无 messages)的按 CPT 验证,其他记录按 ChatML 验证。",
93+
"未指定 --schema 时,state/questions 记录按 decision 验证,包含 wav_fn 的按 TTS 验证,包含 img_path 的按 image 验证,包含 chosen/rejected 的按 DPO 验证,仅含 text(无 messages)的按 CPT 验证,其他记录按 ChatML 验证。",
9194
},
9295
{
9396
"en-US":
94-
"Upload cap: 200MB SFT/DPO text, 300MB CPT, 2GB media zip. Upload uses the OpenAI-compatible /compatible-mode/v1/files endpoint so the purpose tag is persisted (the DashScope-native /api/v1/files drops it).",
97+
"Upload cap: 200MB SFT/DPO text, 300MB CPT/decision data, 2GB media zip. For decision files over 200MB, pass --schema decision so the correct cap is applied. Upload uses the OpenAI-compatible /compatible-mode/v1/files endpoint so the purpose tag is persisted.",
9598
"zh-CN":
96-
"上传上限:SFT/DPO 文本 200MB、CPT 300MB、媒体 ZIP 2GB。上传使用 OpenAI 兼容的 /compatible-mode/v1/files Endpoint,以便保留 purpose 标签;DashScope 原生 /api/v1/files 会丢弃该标签。",
99+
"上传上限:SFT/DPO 文本 200MB、CPT/决策模型数据 300MB、媒体 ZIP 2GB。决策数据超过 200MB 时请显式传入 --schema decision,以应用正确上限。上传使用 OpenAI 兼容的 /compatible-mode/v1/files 接口,以确保持久化 purpose 标签。",
97100
},
98101
],
99102
async run(ctx) {
100103
const { identity, settings, flags } = ctx;
101104
const filePath = flags.file;
102105
const purpose = flags.purpose || "fine-tune";
103106
const schema = parseDatasetSchemaFlag(flags.schema);
104-
// Size caps differ per training type: SFT/DPO 200MB, CPT 300MB, media ZIP 2GB.
107+
// 大小上限按平台数据类型区分;自动识别仍采用保守的文本上限,避免放宽已有格式。
105108
const isMediaSchema = schema === "image" || schema === "video";
106109
const maxBytes = isMediaSchema
107110
? MAX_MEDIA_ZIP_BYTES
108-
: schema === "cpt"
109-
? MAX_CPT_BYTES
110-
: MAX_DATASET_BYTES;
111+
: schema === "decision"
112+
? MAX_DECISION_DATASET_BYTES
113+
: schema === "cpt"
114+
? MAX_CPT_BYTES
115+
: MAX_DATASET_BYTES;
111116

112117
if (!flags.noValidate) {
113118
const result = await validateDataset(filePath, {

‎packages/commands/src/commands/dataset/validate.ts‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
defineCommand,
33
validateDataset,
44
parseDatasetSchemaFlag,
5+
MAX_DECISION_DATASET_BYTES,
56
BailianError,
67
ExitCode,
78
type FlagsDef,
@@ -30,9 +31,9 @@ const VALIDATE_FLAGS = {
3031
valueHint: "<s>",
3132
description: {
3233
"en-US":
33-
'Record schema: "chatml" (SFT), "dpo" (chosen/rejected), "cpt" (raw text), "tts" (audio), "image" (image generation), or "video" (video generation). Default auto-detects per record.',
34+
'Record schema: "chatml" (SFT), "dpo" (chosen/rejected), "cpt" (raw text), "decision" (state/questions), "tts" (audio), "image" (image generation), or "video" (video generation). Default auto-detects per record.',
3435
"zh-CN":
35-
'记录 Schema:"chatml"(SFT)、"dpo"(chosen/rejected)、"cpt"(原始文本)、"tts"(音频)、"image"(图片生成)或 "video"(视频生成)。默认逐条自动识别。',
36+
'记录 Schema:"chatml"(SFT)、"dpo"(chosen/rejected)、"cpt"(原始文本)、"decision"(state/questions 决策数据)、"tts"(音频)、"image"(图片生成)或 "video"(视频生成)。默认逐条自动识别。',
3637
},
3738
},
3839
} satisfies FlagsDef;
@@ -44,12 +45,13 @@ export default defineCommand({
4445
},
4546
// 纯本地校验,不触网、不需 API key(与 `pipeline validate` 一致)。
4647
auth: "none",
47-
usageArgs: "--file <path> [--full-validate] [--schema <chatml|dpo|cpt|tts|image|video>]",
48+
usageArgs: "--file <path> [--full-validate] [--schema <chatml|dpo|cpt|decision|tts|image|video>]",
4849
flags: VALIDATE_FLAGS,
4950
exampleArgs: [
5051
"--file train.jsonl",
5152
"--file dpo.jsonl --schema dpo",
5253
"--file cpt.jsonl --schema cpt",
54+
"--file decision.jsonl --schema decision",
5355
"--file audio.zip --schema tts",
5456
"--file wan-i2v-training-dataset.zip --schema video",
5557
"--file eval.jsonl --full-validate",
@@ -64,15 +66,15 @@ export default defineCommand({
6466
},
6567
{
6668
"en-US":
67-
'Schemas: chatml = {messages:[...]} (SFT); dpo = {messages:[...], chosen, rejected}; cpt = {text:"..."} (continual pre-training, raw text); tts = {wav_fn:"train/xxx.wav", text:"..."} (audio fine-tuning); image = {img_path:"..."} (image generation); video = {first_frame_path:"...", video_path:"..."} (video generation, i2v first-frame or kf2v first+last-frame with last_frame_path).',
69+
'Schemas: chatml = {messages:[...]}; dpo = {messages:[...], chosen, rejected}; cpt = {text:"..."}; decision = {state:{content}, questions:{...}}; tts = {wav_fn:"train/xxx.wav", text:"..."}; image = {img_path:"..."}; video = {first_frame_path:"...", video_path:"..."}.',
6870
"zh-CN":
69-
'Schema:chatml = {messages:[...]}(SFT);dpo = {messages:[...], chosen, rejected};cpt = {text:"..."}(持续预训练,原始文本);tts = {wav_fn:"train/xxx.wav", text:"..."}(音频微调);image = {img_path:"..."}(图片生成);video = {first_frame_path:"...", video_path:"..."}(视频生成,支持 i2v 首帧或通过 last_frame_path 指定 kf2v 首尾帧)。',
71+
'Schema:chatml = {messages:[...]};dpo = {messages:[...], chosen, rejected};cpt = {text:"..."};decision = {state:{content}, questions:{...}};tts = {wav_fn:"train/xxx.wav", text:"..."};image = {img_path:"..."};video = {first_frame_path:"...", video_path:"..."}。',
7072
},
7173
{
7274
"en-US":
73-
"With no --schema, a record carrying wav_fn is validated as TTS, img_path as image, first_frame_path/video_path as video, chosen/rejected as DPO, text (no messages) as CPT, otherwise ChatML. Pass --schema to require a specific shape on every record.",
75+
"With no --schema, state/questions is validated as decision data, wav_fn as TTS, img_path as image, first_frame_path/video_path as video, chosen/rejected as DPO, text (no messages) as CPT, otherwise ChatML.",
7476
"zh-CN":
75-
"未指定 --schema 时,包含 wav_fn 的记录按 TTS 验证,包含 img_path 的按 image 验证,包含 first_frame_path/video_path 的按 video 验证,包含 chosen/rejected 的按 DPO 验证,仅含 text(无 messages)的按 CPT 验证,其他记录按 ChatML 验证。使用 --schema 要求每条记录符合指定结构。",
77+
"未指定 --schema 时,state/questions 记录按 decision 验证,包含 wav_fn 的按 TTS 验证,包含 img_path 的按 image 验证,包含 first_frame_path/video_path 的按 video 验证,包含 chosen/rejected 的按 DPO 验证,仅含 text(无 messages)的按 CPT 验证,其他记录按 ChatML 验证。",
7678
},
7779
{
7880
"en-US":
@@ -98,7 +100,11 @@ export default defineCommand({
98100
return;
99101
}
100102

101-
const result = await validateDataset(filePath, { fullValidate: flags.fullValidate, schema });
103+
const result = await validateDataset(filePath, {
104+
fullValidate: flags.fullValidate,
105+
schema,
106+
maxBytes: schema === "decision" ? MAX_DECISION_DATASET_BYTES : undefined,
107+
});
102108

103109
if (settings.quiet) {
104110
emitBare(result.valid ? "ok" : "fail");

0 commit comments

Comments
 (0)