Skip to content

Commit c3d4d4b

Browse files
authored
Merge pull request #253 from modelstudioai/feat/model-compress
Feat/model compress
2 parents 582988b + f7fa504 commit c3d4d4b

50 files changed

Lines changed: 3448 additions & 126 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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,24 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
2020
- **Parameter validation and messages** — Help and version queries validate supplied flags. Only explicitly declared flag names are accepted, and parsing errors support English and Chinese messages based on the configured language.
2121
- **File upload timeout** — Use `--timeout` to set the transfer timeout when uploading local files to temporary OSS storage.
2222

23+
## [2.2.2] - 2026-10-14
24+
25+
### Added
26+
27+
- **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.
28+
- **Pi agent support** — `bl config agent` and `bl mcp connect` / `bl mcp disconnect` now support Pi, writing its native configuration while preserving existing settings and redacting credentials in output.
29+
- **Global flags before the command path** — Global flags such as `--config` can now precede the command (`bl --config token-plan auth status`) as well as follow it; both select the Profile for that invocation only, without changing `active_config`. Command-specific and credential flags must still follow the command path.
30+
- **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.
31+
32+
### Changed
33+
34+
- **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.
35+
- **Stricter flag validation** — Only flags defined for a command are accepted. Unknown flags, missing values, and invalid values now return usage exit code 2 even when the invocation would otherwise show help, and parser errors follow the Profile language. A bare root or command-group invocation still shows help and returns 0. `--timeout` uses the same positive-finite rule on the command line and in resolved settings.
36+
37+
### Fixed
38+
39+
- **Temporary file upload timeout** — Uploads of local files to temporary OSS storage now honor `--timeout` instead of a fixed 120-second limit.
40+
2341
## [2.2.1] - 2026-10-12
2442

2543
### Fixed

‎CHANGELOG.zh.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,24 @@
2020
- **参数校验与提示** —— 帮助和版本查询会校验已传入的参数;仅接受命令支持的参数名,参数解析错误支持按配置语言显示中英文提示。
2121
- **文件上传超时** —— `--timeout` 可设置本地文件上传至临时 OSS 的传输超时时间。
2222

23+
## [2.2.2] - 2026-10-14
24+
25+
### 新增
26+
27+
- **模型压缩完整生命周期** —— 新增 `bl finetune compress templates/create/list/get/watch/logs/cancel/delete`,支持对符合条件的全参调优模型执行量化压缩,并覆盖 dry-run 预览、状态轮询、日志查询和安全删除确认。
28+
- **支持 Pi Agent** —— `bl config agent` 与 `bl mcp connect` / `bl mcp disconnect` 新增支持 Pi,写入其原生配置并保留已有设置,输出中的凭据会脱敏。
29+
- **全局参数可前置** —— `--config` 等全局参数现在既可放在命令之后,也可放在命令之前(`bl --config token-plan auth status`);两种写法都只对本次调用选择 Profile,不修改 `active_config`。命令专属参数和凭证域参数仍须放在命令路径之后。
30+
- **决策模型推理** —— 新增 `bl decision`,通过工作空间专属 Endpoint 调用 TypeSafe System One,支持 `choice` / `noul` / `score` 校验、JSON 与文本输出、复用训练样本、北京/新加坡地域路由及 dry-run 预览。
31+
32+
### 变更
33+
34+
- **决策数据集校验** —— 与最新 API 对齐:`state` 可为字符串、对象或数组,`instructions` 改为可选,并按接口限制校验各类问题的 criteria。
35+
- **更严格的参数校验** —— 只接受命令已定义的参数。未知参数、缺少参数值或参数值非法时,即使本次调用原本会显示帮助,也返回用法错误退出码 2,解析错误提示跟随 Profile 语言;不带参数的根命令或命令组仍显示帮助并返回 0。`--timeout` 在命令行和最终生效配置中使用同一套“正有限数”校验规则。
36+
37+
### 修复
38+
39+
- **临时文件上传超时** —— 本地文件上传到临时 OSS 存储时会遵循 `--timeout`,不再固定为 120 秒。
40+
2341
## [2.2.1] - 2026-10-12
2442

2543
### 修复

‎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?spm=a2ty07.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?spm=a2ty07.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?spm=a2ty07.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?spm=a2ty07.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, {

0 commit comments

Comments
 (0)