modelstudioai/cli

bailian-opd

Guided end-to-end pure Model OPD distillation (pgopd) on Alibaba Cloud Bailian: authorize → dataset validate → parameter probes → dry-run consent gate → confirmed submit → verified terminal state, driven by deterministic scripts.

Vedi sorgente

Come usare

  1. Copia il comando e controlla il pacchetto prima di installarlo nel tuo ambiente agente.
  2. Controlla strumenti, credenziali e ambienti richiesti nel documento originale.
  3. Descrivi input e risultato desiderato; confronta l’output con le fonti.
npx skills add https://github.com/modelstudioai/cli --skill bailian-opd

Prima di iniziare

  • L’installazione non include abbonamenti, quote API o accesso ai file.
  • Stelle e installazioni indicano attività, non un test indipendente di qualità o sicurezza.
Documento Skill originale

Contenuto dal repository con titoli, esempi, codice, tabelle, link e immagini preservati.

Bailian OPD Distillation Workflow

Create a pure Model OPD training job (training_type=pg_opd, top-level teacher_model, no rollout/reward functions, no Function Compute) with the highest possible first-run success rate. Gate logic lives in deterministic scripts under scripts/; the agent orchestrates, presents findings, and obtains consent — it does not re-implement gates or guess flags.

CRITICAL — shared protocol first. Before executing anything, Read ../bailian-protocol/SKILL.md and follow it: mandatory version pre-flight before the first bl call, consent classes, attribution, error reporting, output conventions. If the protocol skill is missing, stop and prompt bl skill init. Business context for OPD flags lives in skill bailian-finetune (its reference/finetune.md) or bl finetune opd --help — never guess flags.

Attribution

Bundled scripts already carry the protocol script attribution (BAILIAN_CALLER_TYPE=script, BAILIAN_CALLER_NAME from --caller-name). For inline bl commands the agent runs itself, use the protocol agent template, e.g.:

bash
BAILIAN_CALLER_TYPE=agent BAILIAN_CALLER_NAME=codex BAILIAN_SKILL_NAME=bailian-opd BAILIAN_SKILL_VERSION=2.10.2 bl finetune opd authorize --authorize --yes

Prerequisites

  • bl installed and up to date (protocol version pre-flight); node >= 18 on PATH.
  • Two logins: API key (bl auth login --api-key) for data/params/create, and

Console (bl auth login --console) for the OPD feature authorize probe.

  • OPD is invite-only (邀测): the account whitelist must be enabled. Published

student/teacher pairs and sizing: the official OPD docs "模型与训练单元" section (the CLI warns on unpublished pairs).

Workflow (steps 0–7)

0. Protocol pre-flight

Run the protocol version pre-flight; check node --version (>= 18) and bl auth status. Missing Console login blocks only the authorize stage — the preflight report still surfaces everything else.

1. Chain-start authorization

Disclose before any probe: OPD training is MTU postpaid billing (mtu_spec_code × mtu_capacity, charged while the job runs). Obtain the user's consent to start the read-only preflight. This consent covers the authorize probe's --yes (the runtime risk gate requires it even for the read-only probe; the probe never enables anything).

2. Choose a baseline (do not improvise hyper-parameters)

Default to the all-explicit 9B←397B baseline for a first run — every teacher resource field is explicit, so nothing depends on server defaults and capacity is fully computable:

bash
node scripts/opd-preflight.mjs \
  --base-model qwen3.5-9b --teacher-model qwen3.5-397b-a17b \
  --datasets <train.jsonl> --validations <valid.jsonl> \
  --hyper-parameters-file assets/baseline-9b-from-397b.hyper_parameters.json \
  --resource-config-file assets/baseline-9b-from-397b.resource_config.json \
  --caller-name <host>

Second choice: assets/baseline-9b-from-flash.* (9B←qwen3.8-flash, teacher fields omitted → server fills Flash defaults). Capacity guide:

Layoutmtu_capacity
Default student layout (layout fields omitted), 9B + Flash teacher24 (official recommendation; observed default = 16 student + 8 teacher GPUs)
Flash baseline custom layout (4/2 GPUs)16
397B baseline all-explicit (8/8 GPUs + 8 teacher)24

Baselines are dated snapshots of historically successful requests — never "improve" them; apply overrides only when the user explicitly asks. Data format: JSONL, messages with system (task) + user (input); prompt-only is valid for pure distillation; rollout_extra.solution passes through untouched. Data size: batch_size is the samples-per-step, so the training set needs at least ceil(batch_size / n_epochs) effective samples for one step — the preflight batch-fit stage computes the step count and blocks zero-step configurations (they fail at execution time, after billing starts).

3. Preflight report and remediation

Run opd-preflight.mjs (read-only; aggregates all stages in one pass). Present the report. Blocked stages → follow their remediation:

  • Console login missing → bl auth login --console.
  • Service roles REQUIRES_USER_ACTION → surface the manual authorization links

verbatim; the CLI never creates roles.

  • business-enabled: MISSING → only after explicit user confirmation, run

inline: bl finetune opd authorize --authorize --yes. The scripts never enable.

  • Empty parameter schema → the student is not registered for pg_opd; pick a

published student.

  • Workspace 400/403 → the workspace does not match the API key; fix

--workspace-id / config.

  • batch-fit blocked (0 training steps) → add data to at least

ceil(batch_size / n_epochs) samples with headroom, or lower batch_size / raise n_epochs; re-run preflight.

Re-run preflight after remediation until no stage is blocked.

4. Consent gate (mandatory, verbatim)

Present to the user, verbatim from the report:

  • body_preview (the exact request body),
  • every warning (OPD_PAIR_NOT_PUBLISHED, OPD_DEFAULT_LAYOUT_CAPACITY,

OPD_LENGTH_EXCEEDS_TEACHER, OPD_BATCH_FIT_UNKNOWN, OPD_WARMUP_EXCEEDS_STEPS, OPD_INTERVAL_EXCEEDS_STEPS, capacity advice, dataset warnings),

  • pending_uploads (local files that will be uploaded),
  • billing scope: mtu_spec_code × mtu_capacity, MTU postpaid, charged until the

job reaches a terminal state.

Obtain explicit confirmation. Any scope change (model, teacher, data, capacity, hyper-parameters) requires re-running preflight and re-confirming. Never add --yes or --confirmed automatically.

5. Confirmed submit

bash
node scripts/opd-submit.mjs <same assembly flags> --confirmed --caller-name <host>

The script passes --yes to bl finetune opd run only because --confirmed was given after step 4. Local paths are validated and uploaded inside this run. On create failure/timeout the script never retries; it runs a duplicate-creation guard (the server can persist a job and still return 500) and reports duplicate_check. possibly_created → attach to that job, do not resubmit. unknown → stop and report the uncertainty.

6. Monitor to a verified terminal state

bash
node scripts/opd-wait.mjs --job-id <ft-xxx> [--interval 30] [--poll-timeout 3600] --caller-name <host>

(or opd-submit.mjs … --confirmed --wait). Creation returning a job id is NOT success: capacity mismatches fail at execution time, after billing starts. Poll timeout (exit 5) ≠ failure — the job was not canceled; resume with the printed command, never resubmit.

7. Verified success and hand-off

Success = terminal SUCCEEDED and checkpoints listed (the wait script includes them). Give the protocol one-line summary. Export / deployment / metrics → soft hand-off to skill bailian-finetune (bl finetune checkpoints / export / metrics, then bl deploy). Listing jobs: bl finetune list (there is no opd list).

Failure triage

SignalMeaningAction
exit 2usage / local guard (missing MTU fields, bad charge_type, TP ≠ GPUs/node, 0 training steps, mini-batch too large, schema violation)fix inputs; nothing was uploaded or created
exit 3auth missingbl auth login --api-key / --console
exit 5poll timeoutjob still alive; resume waiting
exit 6networkretry the read-only step; never blind-retry create
exit 7requires_confirmationnormal control flow — obtain consent, then --yes/--confirmed
create 500 / timeoutjob may exist anywaytrust duplicate_check; attach or stop-and-report
FAILED message "OPD requires N student GPUs + M teacher GPUs, but the MTU capacity is K"execution-phase capacity mismatchset capacity N+M (or change layout), re-preflight, re-confirm, submit as a NEW job
batch-fit blocked / exit 2 "0 training steps"samples × nepochs < batchsize (samples per step)add data to ≥ ceil(batchsize / nepochs) with headroom, or lower batchsize / raise nepochs; re-preflight, re-confirm
FAILED length errorsstudent lengths exceed teacher limitkeep max_length/max_prompt_length ≤ teacher max_model_len (Flash/Max default 16385); re-confirm

Anti-patterns (hard rules)

  • Never fill the parameter API's recommend_value into requests — it is not the

selected teacher's effective default (Flash/Max teacher max length 16385 vs the generic 33792/34816).

  • Never hardcode teacher defaults into requests; omitted teacher fields are

resolved by the server.

  • Never pass --yes to opd run or --confirmed to the submit script without

explicit user confirmation of the exact scope.

  • Never blind-retry a create; a timeout is not a rejection.
  • opd authorize exit 0 does NOT mean enabled — parse ok / checks.
  • Treat capacity advice as advisory: teacher mode (internal/external) has no

public query API, so the scripts compute both interpretations and warn.

References

  • Shared execution protocol: ../bailian-protocol/SKILL.md
  • OPD command flags and domain rules: skill bailian-finetune, bl finetune opd --help
  • User-facing intro: README.md / README.zh.md
dallo stesso repository

Altri Skills

Tutti gli Skills
modelstudioai
Community

bailian-cli

阿里云百炼 / Aliyun Bailian / DashScope 资源管理与 bl CLI hub: 应用调用与管理(bl flow-agent:调用/创建/更新/发布/删除/复制/版本、工作流画布;旧 bl app call/list 已废弃)、决策模型推理(bl decision)、模型目录/模型列表、用量/额度/配额、免费额度、 工作空间、MCP 市场、pipeline、文件上传、ParseX 文档/音视频解析与字段抽取、Batch 批量推理与 CSV 转换、同步 Batch Chat、console API、登录鉴权与配置、 Agent skill 安装/列表/更新/卸载(bl skill add|list|update|remove,百炼 skill registry)。 用户点名百炼 / DashScope / bl,或继续既有 bl 工作流时直接使用。 共享协议(consent / 版本预检 / 鉴权 / 错误上报)在 bailian-protocol;官方安装 bl skill init。 家族路由:生图/生视频/配音/语音合成/转写 → bailian-gen;精

Installazioni / 1h
4
GitHub Stars
372
Aggiornato
13 nov
modelstudioai
Community

bailian-finetune

阿里云百炼模型精调训练入口:用户要精调、微调、训练自己的模型(fine-tune,支持 SFT / SFT-LoRA / DPO / DPO-LoRA / CPT, 覆盖文本、语音、图像)、校验或上传训练数据集、看训练进度和日志、挑 checkpoint、导出精调产物、 把专属模型部署成服务时使用 bl dataset / bl finetune / bl deploy。链路是 validate 校验数据 → upload 拿 file-id → finetune create 建任务 → watch 看进度 → export 导出 → 可选 compress 量化压缩 → deploy 上线,需要 API key; Console 版本状态与独立部署服务查询使用 Console 鉴权。 写操作先用 --dry-run 预览。反触发:用户点名火山方舟/ark 的精调不走本 skill;只是要选哪个模型走 bailian-model-recommend;用现成模型生图生视频走 bailian-gen;百炼其他资源管理走 bailian-cli。 官方安装:bl skill init(与共

Installazioni / 1h
4
GitHub Stars
372
Aggiornato
13 nov
modelstudioai
Community

bailian-gen

阿里云百炼图片/视频/语音生成与理解入口:用户要生图、画图、生成照片、生成图片、AI 绘画、海报、头像、插画、 文生图(text-to-image)、图生图、改图、修图、多图合成、生成视频、文生视频、图生视频、参考生视频、视频编辑、风格转换、 配音、语音合成(TTS)、朗读、转写、语音识别(ASR),或图片理解、看图问答、视频理解、读视频、多模态理解时使用 bl image / bl video / bl speech / bl vision describe / bl omni。 默认行为:用户未指定服务商时,生成/编辑默认走本技能;视频理解与宿主放不了的音视频理解也走本技能。 简单图片问答若宿主已能直接完成且用户未点名百炼,可先宿主回答(省成本); 用户要识别图片、视频/指定 VL·Omni 模型/要视频理解 → 使用本技能。 图片和语音同步返回并落地本地文件,视频是异步任务、用 --download 或轮询取回;本地文件直接传路径,CLI 自动上传。 反触发:普通问答、编程、写作、翻译不走本技能;百炼应用/知识库/用量/额度走 bailian-cli; 精调训练走 bailian

Installazioni / 1h
4
GitHub Stars
372
Aggiornato
13 nov
modelstudioai
Community

bailian-knowledge

个人资料接入与知识库使用。当任务需要参考用户自己的历史文档、客户资料、旧方案、会议记录或学习材料时使用, 如“参考以前的资料准备会议”“照旧方案写一版”“之前为什么这样决定”;不要求用户说“知识库”或点名百炼。 用户希望一批资料以后反复使用,或要求接入、更新、查看、暂停、恢复、清理资料库时也使用。 也处理明确的 bl knowledge / kscli 资源操作。纯通用问答、仅总结当前附件、无历史资料需要的写作不触发; 个人偏好与聊天记忆属于 bailian-memory,钉钉文档管理、模型选型与微调不属于本 Skill。

Installazioni / 1h
4
GitHub Stars
372
Aggiornato
13 nov