bailian-train-deploy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

百炼模型训练→部署闭环 (
bl
)

Bailian Model Training → Deployment Loop (
bl
)

用百炼 CLI
bl
把模型部署成可调用的专属推理服务——可以先微调再部署,也可以跳过训练直接部署基座。支持文本、音频 TTS 和图像生成三种模态,两处"等待"用 Monitor 异步轮询,不阻塞主流程。
链路 A(先训练后部署):
数据集 → finetune <模态> create → 等 SUCCEEDED → 导出模型(通常自动) → deploy <模态> create → 等 RUNNING → 调用

链路 B(直接部署基座,跳过训练):
选基座 → deploy <模态> create → 等 RUNNING → 调用
链路 B 适用于"只想把某个基座跑成自己的部署服务"——和直接调用 API 在推理上没本质区别,但能拿到独立部署实例、可调速率/计费方式、纳入自己的运维。仅当用户明确表示不训练 / 跳过训练 / 直接部署基座时才走这条;用户只是没提训练细节时,默认按链路 A 引导,不要擅自跳过训练。
模态分发:本技能的通用流程适用于所有模态,但数据格式、超参、推理命令因模态而异。确定用户意图后,按模态查阅对应参考文件:
  • 文本模型(对话/推理)→
    references/text.md
  • 音频 TTS 模型(语音合成/CosyVoice)→
    references/audio.md
  • 图像生成模型(文生图/图生图/Wan2.7)→
    references/image.md
  • 未来新增模态 = 新增对应 reference 文件,本流程骨架不变
本技能假设
bl
(bailian-cli)已安装。命令/flag 细节以
bl <cmd> --help
为准;本技能聚焦流程编排与避坑
Deploy models into callable exclusive inference services using Bailian CLI
bl
— you can fine-tune first then deploy, or deploy base models directly skipping training. Supports three modalities: text, audio TTS, and image generation. The two "waiting" steps use Monitor for asynchronous polling without blocking the main process.
Pipeline A (Train first then deploy):
Dataset → finetune <modal> create → Wait for SUCCEEDED → Export model (usually automatic) → deploy <modal> create → Wait for RUNNING → Inference

Pipeline B (Deploy base model directly, skip training):
Select base model → deploy <modal> create → Wait for RUNNING → Inference
Pipeline B applies to scenarios where you "just want to run a certain base model as your own deployment service" — there's no essential difference from directly calling the API for inference, but you get an independent deployment instance, adjustable rate/billing method, and can integrate it into your own O&M. Only use this pipeline when users explicitly state they don't want to train / skip training / deploy base models directly; when users only don't mention training details, guide them using Pipeline A by default, do not skip training without permission.
Modality Distribution: The general process of this skill applies to all modalities, but data formats, hyperparameters, and inference commands vary by modality. After confirming the user's intent, refer to the corresponding reference file by modality:
  • Text Models (dialogue/inference) →
    references/text.md
  • Audio TTS Models (speech synthesis/CosyVoice) →
    references/audio.md
  • Image Generation Models (text-to-image/image-to-image/Wan2.7) →
    references/image.md
  • Future new modalities = add corresponding reference files, the skeleton of this process remains unchanged
This skill assumes
bl
(bailian-cli) is already installed. For details on commands/flags, refer to
bl <cmd> --help
; this skill focuses on process orchestration and pitfall avoidance.

写操作护栏(创建前必读)

Write Operation Guardrails (Read Before Creation)

bl finetune <模态> create
bl deploy <模态> create
都是真实写操作,会产生计费资源(微调训练 + 推理部署)。
bl
没有
--dry-run
,所以用预检命令代替预演、用计费确认把关预留资源。任何写操作前必须先过这三道闸:
  1. 预检代替 dry-run(创建前必跑,确认可行再写)。这些预检命令本身都需先通过下方前置检查的认证——未认证先
    bl auth login
    再预检:
    • 训练前:
      bl finetune capability --model <base>
      —— 确认基座支持你选的 training-type(不支持会快速失败且不耗配额;
      create
      提交时也会再校验一次)。
    • 部署前:
      bl deploy models --source custom
      (链路 A 微调输出)或
      --source base
      (链路 B 基座)—— 确认目标模型可部署、看清可用 plan,再决定
      --plan
    • 复用检测:
      bl deploy list --status RUNNING
      —— 若已有引用同一
      finetuned_output
      且 RUNNING 的部署,直接复用其
      deployed_model
      不要再建第二个计费实例
  2. 计费确认硬闸门(mu/ptu)
    • lora
      (默认,按 token 计费,闲置一般不计费)—— 安全默认,可直接创建。
    • mu
      /
      ptu
      预留/独占资源,闲置也计费——创建前必须向用户显式说明计费方式并取得确认。在 agent / CI 等非交互环境不能自动开通预留资源。命中 mu/ptu 时,把“这会产生闲置计费”连同命令交还给真人在终端确认(
      bl
      当前不提供
      --yes
      跳过确认 flag,确认行为完全由真人把控)。
  3. 账号就绪检查
    bl auth status
    ——
    authenticated: false
    即停,给
    bl auth login --api-key sk-...
    。百炼走 API key / access token 认证,没有独立的实名闸门
    auth status
    即账号就绪检查。
bl finetune <modal> create
and
bl deploy <modal> create
are real write operations that will generate billed resources (fine-tuning training + inference deployment).
bl
does not have
--dry-run
, so use pre-check commands instead of dry runs and billing confirmation to gate reserved resources. Any write operation must pass these three gates first:
  1. Pre-check instead of dry-run (must run before creation, confirm feasibility before writing). These pre-check commands require authentication via the Pre-checks below — if not authenticated, run
    bl auth login
    first then perform pre-checks:
    • Before training:
      bl finetune capability --model <base-model>
      — confirm that the base model supports the training-type you selected (if not supported, it will fail quickly without consuming quotas; the
      create
      submission will also validate this again).
    • Before deployment:
      bl deploy models --source custom
      (fine-tuned output for Pipeline A) or
      --source base
      (base model for Pipeline B) — confirm that the target model can be deployed, check available plans, then decide on
      --plan
      .
    • Reuse detection:
      bl deploy list --status RUNNING
      — if there is already a running deployment referencing the same
      finetuned_output
      , directly reuse its
      deployed_model
      , do not create a second billed instance.
  2. Billing Confirmation Hard Gate (mu/ptu):
    • lora
      (default, billed by token, generally no charge when idle) — safe default, can be created directly.
    • mu
      /
      ptu
      are reserved/exclusive resources, billed even when idle — before creation, must explicitly explain the billing method to the user and obtain confirmation. In non-interactive environments such as agents / CI, do not automatically enable reserved resources. When mu/ptu is involved, hand over the command along with "this will incur idle charges" to a human for confirmation in the terminal (currently
      bl
      does not provide a
      --yes
      flag to skip confirmation, and confirmation is fully controlled by humans).
  3. Account Readiness Check:
    bl auth status
    — stop if
    authenticated: false
    , provide
    bl auth login --api-key sk-...
    . Bailian uses API key / access token for authentication, there is no separate real-name verification gate,
    auth status
    serves as the account readiness check.

反触发表(不归本 skill 的意图,附完整命令)

Anti-Trigger List (Intents Not Covered by This Skill, with Complete Commands)

用户意图路由到完整示范命令
只想试模型效果 / 一次性对话
bailian-cli
bl text chat --model qwen3-8b --message "..."
已确定模型,只要调用方式
bailian-cli
bl text chat --model <model> --message "..."
不知道选哪个基座 / 模型选型
bailian-model-recommend
(让该 skill 按场景推荐)
纯查模型参数 / 价格 / 上下文窗口
bailian-docs-llm-wiki
(查模型数据目录)
已有部署,只想生成调用示例
bailian-cli
bl text chat --model <deployed_model> --message "..."
bl speech synthesize --model <deployed_model> --voice default --text "..."
或异步 API + 触发词(图像生成,见 image.md
对已有训练任务 / 部署做查删(生命周期)
bl
直接
bl finetune list
/
bl deploy list
/
bl deploy delete --deployed-model <id>
本 skill 只负责"新建训练任务 + 新建部署 + 调用交付"这一条闭环。训练任务与部署的全生命周期管理(list / stop / delete 历史任务、删除部署等)不在本 skill 流程内,用
bl finetune list
/
bl deploy list
/
bl deploy delete
直接操作。
User IntentRoute toComplete Example Command
Just want to test model performance / one-time dialogue
bailian-cli
bl text chat --model qwen3-8b --message "..."
Model is confirmed, only need inference methods
bailian-cli
bl text chat --model <model> --message "..."
Don't know which base model to choose / model selection
bailian-model-recommend
(Let that skill recommend based on scenarios)
Purely check model parameters / price / context window
bailian-docs-llm-wiki
(Check model data directory)
Deployment already exists, only need to generate inference examples
bailian-cli
bl text chat --model <deployed_model> --message "..."
or
bl speech synthesize --model <deployed_model> --voice default --text "..."
or asynchronous API + trigger words (image generation, see image.md)
Query/delete existing training tasks / deployments (lifecycle management)Directly use
bl
bl finetune list
/
bl deploy list
/
bl deploy delete --deployed-model <id>
This skill only handles the closed loop of "create new training task + create new deployment + deliver inference". Full lifecycle management of training tasks and deployments (list / stop / delete historical tasks, delete deployments, etc.) is not within the scope of this skill; use
bl finetune list
/
bl deploy list
/
bl deploy delete
for direct operations.

反幻觉清单

Anti-Hallucination Checklist

  • --model
    在不同命令里含义不同,切勿复用
    • bl finetune <模态> create --model
      → 基座模型名(文本
      qwen3-8b
      ,音频
      cosyvoice-v3-flash
      ,图像
      wan2.7-image-pro
      )。
    • bl deploy <模态> create --model
      → 导出模型名(链路 A:
      qwen3-8b-ft-...
      /
      cosyvoice-v3-flash-ft-...
      /
      wan2.7-image-pro-ft-...
      ;链路 B:基座名)。
    • 推理命令
      --model
      → 必须用
      deploy <模态> create
      响应里的
      deployed_model
      不是你传给 deploy <模态> create 的名字。
  • --training-type
    取值穷举
    sft
    /
    sft-lora
    (默认)/
    dpo
    /
    dpo-lora
    /
    cpt
    。映射在 CLI 边界完成(
    sft-lora
    efficient_sft
    ),永远传 CLI 值,不要传服务端字符串。
    cpt
    -lora
    变体。音频 TTS 和图像生成都只用
    sft-lora
    ——
    finetune audio create
    /
    finetune image create
    不暴露此 flag,仅
    finetune text create
    接受。
  • --plan
    取值穷举
    lora
    (默认,token 计费)/
    ptu
    (需
    --input-tpm
    /
    --output-tpm
    )/
    mu
    (需
    --deploy-spec
    /
    --capacity
    )。链路 B 基座通常不支持
    lora
    。音频 TTS 微调模型只支持
    mu
    。图像生成微调模型只支持
    lora
  • --deploy-spec
    (非 template-id):mu plan 的部署规格 flag。CLI 从 catalog 读取
    template_id
    ,在请求体中发送为
    deploy_spec
  • --source
    取值穷举
    bl deploy models
    ):
    custom
    (微调输出)/
    base
    (基座)/
    public
  • --learning-rate
    必须字符串
    :传
    "3e-4"
    ,不要传数字
    3e-4
    ,避免 JSON 精度丢失(文本适用,音频/图像不需要传此参数)。
  • 推理命令因模态不同:文本模型用
    bl text chat
    ,音频 TTS 用
    bl speech synthesize --voice default
    ,图像生成用异步 API + 触发词(详见
    references/image.md
    )。
  • 没有这些 flag/子命令
    bl
    --dry-run
    、无裸
    finetune create
    /
    deploy create
    必须带模态段
    finetune text|audio|image create
    deploy text|audio|image create
    )、无
    finetune start
    、无
    deploy stop
    (CLI 暂无 stop 命令,RUNNING 的 mu/ptu 需到控制台停用)。
  • 必填
    finetune <模态> create
    --model
    /
    --datasets
    deploy <模态> create
    --model
    /
    --name
  • --model
    has different meanings in different commands, do not reuse it
    :
    • bl finetune <modal> create --model
      → Base model name (text
      qwen3-8b
      , audio
      cosyvoice-v3-flash
      , image
      wan2.7-image-pro
      ).
    • bl deploy <modal> create --model
      → Exported model name (Pipeline A:
      qwen3-8b-ft-...
      /
      cosyvoice-v3-flash-ft-...
      /
      wan2.7-image-pro-ft-...
      ; Pipeline B: base model name).
    • Inference command
      --model
      → Must use
      deployed_model
      from the response of
      deploy <modal> create
      , not the name you passed to deploy <modal> create.
  • --training-type
    values are exhaustive
    :
    sft
    /
    sft-lora
    (default) /
    dpo
    /
    dpo-lora
    /
    cpt
    . Mapping is completed at the CLI boundary (
    sft-lora
    efficient_sft
    ), always pass CLI values, do not pass server-side strings.
    cpt
    has no
    -lora
    variant. Audio TTS and image generation only use
    sft-lora
    finetune audio create
    /
    finetune image create
    do not expose this flag, only
    finetune text create
    accepts it.
  • --plan
    values are exhaustive
    :
    lora
    (default, billed by token) /
    ptu
    (requires
    --input-tpm
    /
    --output-tpm
    ) /
    mu
    (requires
    --deploy-spec
    /
    --capacity
    ). Base models in Pipeline B usually do not support
    lora
    . Audio TTS fine-tuned models only support
    mu
    . Image generation fine-tuned models only support
    lora
    .
  • --deploy-spec
    (not template-id): Deployment specification flag for mu plan. The CLI reads
    template_id
    from the catalog and sends it as
    deploy_spec
    in the request body.
  • --source
    values are exhaustive
    (
    bl deploy models
    ):
    custom
    (fine-tuned output) /
    base
    (base model) /
    public
    .
  • --learning-rate
    must be a string
    : Pass
    "3e-4"
    , do not pass the number
    3e-4
    to avoid JSON precision loss (applies to text models, not required for audio/image).
  • Inference commands vary by modality: Use
    bl text chat
    for text models,
    bl speech synthesize --voice default
    for audio TTS models, and asynchronous API + trigger words for image generation (see
    references/image.md
    ).
  • These flags/subcommands do not exist:
    bl
    has no
    --dry-run
    , no bare
    finetune create
    /
    deploy create
    (must include modality segment:
    finetune text|audio|image create
    ,
    deploy text|audio|image create
    ), no
    finetune start
    , no
    deploy stop
    (CLI has no stop command yet, running mu/ptu instances need to be disabled in the console).
  • Required parameters:
    --model
    /
    --datasets
    for
    finetune <modal> create
    ;
    --model
    /
    --name
    for
    deploy <modal> create
    .

前置检查(动作流起点)

Pre-checks (Start of Action Flow)

  • 认证:
    bl auth status
    ,确认已配置 API key(
    DASHSCOPE_API_KEY
    bl auth login --api-key sk-...
    )。
  • 基座选型:查询训练能力用
    bl finetune capability
    (查 listFoundationModels,走 API key、无需 console 登录):
    • bl finetune capability --model <base>
      —— 该模型支持哪些训练类型。
    • bl finetune capability --training-type sft-lora
      —— 反向查:哪些模型支持该训练类型(返回
      models
      列表,含中文名)。
    • 选定基座后可直接进入第 2 步;
      bl finetune <模态> create
      提交前也会再用 listFoundationModels 校验,不支持会快速失败。
    • 文本推理推荐 Qwen3 系列(
      qwen3-8b
      /
      qwen3-14b
      /
      qwen3.6-flash
      );音频 TTS 用
      cosyvoice-v3-flash
      ;图像生成用
      wan2.7-image-pro
      /
      wan2.7-image
  • Authentication:
    bl auth status
    , confirm API key is configured (
    DASHSCOPE_API_KEY
    or
    bl auth login --api-key sk-...
    ).
  • Base model selection: Query training capabilities with
    bl finetune capability
    (queries listFoundationModels, uses API key, no console login required):
    • bl finetune capability --model <base-model>
      — which training types are supported by this model.
    • bl finetune capability --training-type sft-lora
      — reverse query: which models support this training type (returns
      models
      list with Chinese names).
    • After selecting a base model, you can directly proceed to Step 2;
      bl finetune <modal> create
      will also validate with listFoundationModels before submission, and will fail quickly if not supported.
    • Recommended text inference models are Qwen3 series (
      qwen3-8b
      /
      qwen3-14b
      /
      qwen3.6-flash
      ); use
      cosyvoice-v3-flash
      for audio TTS; use
      wan2.7-image-pro
      /
      wan2.7-image
      for image generation.

第 1 步:准备数据集

Step 1: Prepare Dataset

支持三种数据来源,由你(Agent)根据用户意图灵活选用,不必写死交互流程——你本身具备主动提问能力,知道有哪些选项后自然向用户确认即可:
  1. 本地数据集 —— 用户提供本地文件路径,直接使用。
  2. 已上传数据集 —— 从百炼上已有的数据集中选取(
    bl dataset list
    )。
  3. 生成示例数据 —— 征得用户同意后,由你生成一份小规模示例数据,仅用于跑通流程(效果有限,需如实告知用户)。
数据格式因模态不同,详见对应参考文件:
  • 文本模型
    .jsonl
    文件(ChatML/DPO/CPT schema),详见
    references/text.md
  • 音频 TTS
    .zip
    包(内含
    data.jsonl
    +
    train/*.wav
    ),详见
    references/audio.md
  • 图像生成
    .zip
    包(内含
    data.jsonl
    + 图像文件平铺),详见
    references/image.md
提交训练前用
bl dataset validate --file <path>
校验通过再继续(CLI 自动探测 schema,也可
--schema tts
/
--schema image
/
--schema chatml
显式指定)。
Supports three data sources, you (Agent) can flexibly choose based on user intent, do not hardcode the interaction process — you have the ability to ask questions proactively, so naturally confirm with users after knowing the options:
  1. Local Dataset — User provides local file path, use directly.
  2. Uploaded Dataset — Select from existing datasets on Bailian (
    bl dataset list
    ).
  3. Generate Sample Data — With user consent, generate a small-scale sample data only for running through the process (limited effect, need to inform users truthfully).
Data format varies by modality, see corresponding reference files:
  • Text Models:
    .jsonl
    files (ChatML/DPO/CPT schema), see
    references/text.md
    .
  • Audio TTS:
    .zip
    package (contains
    data.jsonl
    +
    train/*.wav
    ), see
    references/audio.md
    .
  • Image Generation:
    .zip
    package (contains
    data.jsonl
    + flat image files), see
    references/image.md
    .
Before submitting training, run
bl dataset validate --file <path>
to pass validation before proceeding (CLI automatically detects schema, you can also explicitly specify with
--schema tts
/
--schema image
/
--schema chatml
).

第 2 步:创建微调任务

Step 2: Create Fine-tuning Task

bash
bl finetune <模态> create \
  --model <base-model> \
  --datasets <path-or-file-id> \
  --output json
training-type 取值与映射详见
references/finetune.md
模态特异性超参见对应参考文件:
  • 文本模型(
    finetune text create
    ):接受
    --training-type
    /
    --n-epochs
    /
    --learning-rate
    等,详见
    references/text.md
  • 音频 TTS(
    finetune audio create
    ):不暴露
    --training-type
    (内部固定
    sft-lora
    ),超参由 CLI 自动注入,详见
    references/audio.md
  • 图像生成(
    finetune image create
    ):不暴露
    --training-type
    (内部固定
    sft-lora
    ),超参由 CLI 自动注入,详见
    references/image.md
从响应记下:
output.job_id
output.finetuned_output
(输出模型名,形如
<base>-ft-<ts>-<id>
)。
bash
bl finetune <modal> create \
  --model <base-model> \
  --datasets <path-or-file-id> \
  --output json
training-type values and mapping see
references/finetune.md
. Modality-specific hyperparameters see corresponding reference files:
  • Text models (
    finetune text create
    ): Accept
    --training-type
    /
    --n-epochs
    /
    --learning-rate
    , etc., see
    references/text.md
    .
  • Audio TTS (
    finetune audio create
    ): Does not expose
    --training-type
    (internally fixed to
    sft-lora
    ), hyperparameters are automatically injected by CLI, see
    references/audio.md
    .
  • Image generation (
    finetune image create
    ): Does not expose
    --training-type
    (internally fixed to
    sft-lora
    ), hyperparameters are automatically injected by CLI, see
    references/image.md
    .
Record from the response:
output.job_id
,
output.finetuned_output
(exported model name, in the format
<base>-ft-<ts>-<id>
).

第 3 步:等待训练完成(异步)

Step 3: Wait for Training Completion (Asynchronous)

用 Monitor 工具运行本技能自带的等待脚本——它会在状态变化时通知,到终态退出:
Monitor command: bash <本技能目录>/scripts/wait.sh finetune <JOB_ID>
<本技能目录>
即本技能的 base 目录(技能加载时会给出,含
scripts/wait.sh
),用实际路径替换。脚本每 30s 轮询,终态为
SUCCEEDED
/
FAILED
/
CANCELED
/
PARTIALLY_SUCCEEDED
⚠️ 避坑:不要在 zsh 里手写
status=...
轮询循环。
status
是 zsh 的只读内置变量,赋值会报
read-only variable
并让脚本 exit 1。用本技能的 bash 脚本(
#!/usr/bin/env bash
)规避,或自写时改用
st
等变量名。
Use the Monitor tool to run the built-in waiting script of this skill — it will notify when status changes and exit when reaching terminal state:
Monitor command: bash <skill-directory>/scripts/wait.sh finetune <JOB_ID>
<skill-directory>
is the base directory of this skill (provided when the skill is loaded, contains
scripts/wait.sh
), replace with the actual path. The script polls every 30s, terminal states are
SUCCEEDED
/
FAILED
/
CANCELED
/
PARTIALLY_SUCCEEDED
.
⚠️ Pitfall Avoidance: Do not write a manual
status=...
polling loop in zsh.
status
is a read-only built-in variable in zsh, assigning it will report
read-only variable
and exit the script with code 1. Use the bash script of this skill (
#!/usr/bin/env bash
) to avoid this, or use variable names like
st
when writing your own.

第 4 步:导出最佳模型(通常可跳过)

Step 4: Export Best Model (Usually Skippable)

任务 SUCCEEDED 后,平台会自动导出 best checkpoint 为可部署模型——直接进第 5 步即可,无需手动导出。
只有要部署非 best 的某个 checkpoint 时才显式导出:
bash
bl finetune checkpoints --job-id <JOB_ID>          # 列出可用 checkpoint
bl finetune export --job-id <JOB_ID> --checkpoint <name> --model-name <自定义名>
After the task is SUCCEEDED, the platform will automatically export the best checkpoint as a deployable model — you can directly proceed to Step 5 without manual export.
Only explicitly export when you need to deploy a non-best checkpoint:
bash
bl finetune checkpoints --job-id <JOB_ID>          # List available checkpoints
bl finetune export --job-id <JOB_ID> --checkpoint <name> --model-name <custom-name>

第 5 步:创建部署

Step 5: Create Deployment

创建前先过写操作护栏
bl deploy list --status RUNNING
查是否已有同模型部署可复用;
bl deploy models --source custom|base
确认可用 plan;
mu
/
ptu
必须先取得用户计费确认。
⚠️ 关键避坑:微调后的模型不能直接用微调输出名调用,会 404
Model not exist
。必须先创建部署。
(链路 B 部署基座同理——直接调用走的是公共推理,不经过你的部署实例。)
bash
bl deploy <模态> create \
  --model <model-name> \              # 微调输出名(链路A) 或基座名(链路B)
  --name <display-name> \
  --plan <lora|ptu|mu> \              # 见下方说明
  --output json
  • 模态段
    text
    /
    audio
    /
    image
    )须与部署模型模态匹配;三个模态子命令 flag 完全相同。
  • --model
    :链路 A 传第 2 步的
    finetuned_output
    ;链路 B 直接传基座模型名。
  • --plan
    • 文本微调模型默认
      lora
      (token 计费),也可用
      mu
    • 音频 TTS 微调模型只支持
      mu
      (不支持
      lora
      /
      ptu
      ),需
      --deploy-spec
      +
      --capacity
    • 图像生成微调模型只支持
      lora
      (不支持
      mu
      /
      ptu
      )。
    • 链路 B 基座通常只支持
      ptu
      /
      mu
      不支持
      lora
    • 各 plan 必填参数与计费细则见
      references/deploy.md
  • --deploy-spec
    :mu plan 的部署规格(如
    dps-20260521172224-1vabse
    ),省略时自动从 catalog 匹配。
  • 不确定支持哪些 plan:链路 A 用
    bl deploy models --source custom
    ,链路 B 用
    bl deploy models --source base
    ,按返回的
    plans
    选。
⚠️ 避坑(最高频错误):
--model
deploy <模态> create
与推理命令里含义不同
——
deploy <模态> create --model
传导出模型名,响应返回的
output.deployed_model
才是部署实例 id,推理命令
--model
必须用
deployed_model
不要复用。详见
references/deploy.md
从响应记下:
output.deployed_model
Before creation, pass the Write Operation Guardrails:
bl deploy list --status RUNNING
to check if there is an existing deployment of the same model that can be reused;
bl deploy models --source custom|base
to confirm available plans;
mu
/
ptu
must obtain user billing confirmation first.
⚠️ Critical Pitfall: Fine-tuned models cannot be directly called using the fine-tuned output name, it will return 404
Model not exist
. You must create a deployment first.
(Same for deploying base models in Pipeline B — direct calling uses public inference and does not go through your deployment instance.)
bash
bl deploy <modal> create \
  --model <model-name> \              # Fine-tuned output name (Pipeline A) or base model name (Pipeline B)
  --name <display-name> \
  --plan <lora|ptu|mu> \              # See explanation below
  --output json
  • Modality segment (
    text
    /
    audio
    /
    image
    ) must match the modality of the deployed model; the flags of the three modality subcommands are identical.
  • --model
    : Pass
    finetuned_output
    from Step 2 for Pipeline A; directly pass the base model name for Pipeline B.
  • --plan
    :
    • Default
      lora
      (billed by token) for text fine-tuned models,
      mu
      is also available.
    • Audio TTS fine-tuned models only support
      mu
      (do not support
      lora
      /
      ptu
      ), require
      --deploy-spec
      +
      --capacity
      .
    • Image generation fine-tuned models only support
      lora
      (do not support
      mu
      /
      ptu
      ).
    • Base models in Pipeline B usually only support
      ptu
      /
      mu
      , do not support
      lora
      .
    • Required parameters and billing details for each plan see
      references/deploy.md
      .
  • --deploy-spec
    : Deployment specification for mu plan (e.g.,
    dps-20260521172224-1vabse
    ), automatically matched from the catalog if omitted.
  • Unsure which plans are supported: Use
    bl deploy models --source custom
    for Pipeline A,
    bl deploy models --source base
    for Pipeline B, select from the returned
    plans
    .
⚠️ Top-Frequency Error Pitfall:
--model
has different meanings in
deploy <modal> create
and inference commands
deploy <modal> create --model
passes the exported model name,
output.deployed_model
returned in the response is the deployment instance ID, and the inference command
--model
must use
deployed_model
, do not reuse the exported model name. See
references/deploy.md
.
Record from the response:
output.deployed_model
.

第 6 步:等待部署就绪(异步)

Step 6: Wait for Deployment Readiness (Asynchronous)

Monitor command: bash <本技能目录>/scripts/wait.sh deploy <DEPLOYED_MODEL>
<本技能目录>
同第 3 步。每 15s 轮询,
RUNNING
即就绪(
FAILED
/
STOPPED
终止)。
⚠️ 避坑:状态传播延迟。 部署刚到
RUNNING
时立即调用,可能短暂返回 404
Model not exist
——这是服务端状态传播延迟,不是用错模型名。
bl deploy get
也可能还显示
PENDING
。约 1 分钟内会稳定,遇 404 等十几秒重试即可;若持续 404,先核对用的是
deployed_model
而非微调输出名。
Monitor command: bash <skill-directory>/scripts/wait.sh deploy <DEPLOYED_MODEL>
<skill-directory>
is the same as in Step 3. Polls every 15s,
RUNNING
means ready (terminate if
FAILED
/
STOPPED
).
⚠️ Pitfall Avoidance: Status Propagation Delay. Immediately calling the model when deployment just reaches
RUNNING
may briefly return 404
Model not exist
— this is server-side status propagation delay, not an incorrect model name.
bl deploy get
may also still show
PENDING
. It will stabilize within about 1 minute; if you encounter 404, wait ten seconds and retry; if it persists, first check if you are using
deployed_model
instead of the fine-tuned output name.

第 7 步:调用与交付

Step 7: Inference and Delivery

推理命令因模态不同
文本模型:
bash
bl text chat --model <DEPLOYED_MODEL> --message "你的问题"
音频 TTS 模型:
bash
bl speech synthesize --model <DEPLOYED_MODEL> --voice default --text "你要合成的文本" --out result.mp3
图像生成模型(异步 API,需触发词):
bash
undefined
Inference commands vary by modality:
Text models:
bash
bl text chat --model <DEPLOYED_MODEL> --message "Your question"
Audio TTS models:
bash
bl speech synthesize --model <DEPLOYED_MODEL> --voice default --text "Text you want to synthesize" --out result.mp3
Image generation models (asynchronous API, requires trigger words):
bash
undefined

详见 references/image.md —— 需 X-DashScope-Async 头 + prompt 含触发词

See references/image.md — requires X-DashScope-Async header + prompt containing trigger words


> `--model` 必须用 `deploy <模态> create` 响应中的 `deployed_model`,**不是**微调输出名。音频 TTS 的 `--voice` 固定为 `default`。图像生成需异步调用且 prompt 包含触发词。详见对应模态参考文件。

向用户交付时给出:
- **部署实例 id**(`deployed_model`)——调用用它,不是微调输出名
- 一条可直接运行的推理示例命令
- 常用运维命令:`bl deploy get --deployed-model <id>` 查状态;`bl deploy delete --deployed-model <id>` 删除部署;`bl finetune list` 查历史任务。

> `--model` must use `deployed_model` from the response of `deploy <modal> create`, **not** the fine-tuned output name. `--voice` for audio TTS is fixed to `default`. Image generation requires asynchronous calling and prompts containing trigger words. See corresponding modality reference files.

When delivering to users, provide:
- **Deployment instance ID** (`deployed_model`) — use this for inference, not the fine-tuned output name
- One directly executable inference example command
- Common O&M commands: `bl deploy get --deployed-model <id>` to check status; `bl deploy delete --deployed-model <id>` to delete deployment; `bl finetune list` to check historical tasks.

收尾提示

Closing Tips

  • 闲置计费与删除
    lora
    闲置一般不计费;
    mu
    /
    ptu
    闲置也计费,不用要清理,且
    bl deploy delete
    有状态约束(CLI 无 stop 命令)。细则见
    references/deploy.md
  • 复用数据集:多次训练同一数据时,先
    bl dataset upload
    拿 file-id,再用
    --datasets <file-id>
    避免重复上传。
  • 效果不好:优先加数据(量与质量),其次调
    n-epochs
    /
    learning-rate
    ,最后才考虑全参
    sft
    。小数据集(<100 条)效果上限有限,要管理预期。
  • Idle Charges and Deletion:
    lora
    generally has no charge when idle;
    mu
    /
    ptu
    are charged even when idle, clean them up when not in use, and
    bl deploy delete
    has status constraints (CLI has no stop command). Details see
    references/deploy.md
    .
  • Reuse Datasets: When training with the same data multiple times, first run
    bl dataset upload
    to get a file-id, then use
    --datasets <file-id>
    to avoid repeated uploads.
  • Poor Performance: Prioritize adding data (quantity and quality), then adjust
    n-epochs
    /
    learning-rate
    , and finally consider full-parameter
    sft
    . Small datasets (<100 entries) have limited performance upper limits, manage expectations accordingly.