Skip to content

kali20gakki/msAgent / skills/quantizer/quant-tuning-quantize-dit

quant-tuning-quantize-dit

Verified

assets/w8a8_dynamic.example.yaml

View on GitHub
# W8A8 动态(data-free)量化 YAML 示例 — DiT(扩散/多模态生成)
#
# 本示例以 HunyuanVideo(重构路径)为参考,结构与 msmodelslim 主仓
# `lab_practice/hunyuan_video/hunyuan_video_w8a8f8_mxfp.yaml` 对齐。
# HunyuanVideo 是当前 **唯一**已迁移到 `MultimodalPipelineInterface` 且
# lab_practice YAML 已 validated 的 DiT;其它 DiT(Wan2.2-T2V/I2V/TI2V、
# FLUX.1-dev(已迁移)、SD3、Sana、HunyuanDiT、CogViewX 等)的 YAML
# 在 `inference_config` 字段集合上需按各自推理仓的 `parse_args` 调整。
#
# 重要:
#   - apiversion 固定为 multimodal_sd_modelslim_v1;
#   - 走 MultimodalSDModelslimV1QuantService,统一 MultimodalPipelineInterface 重构路径;
#     不再保留 LegacyMultimodalPipelineInterface;
#   - "data-free" 指 **不引入外部激活校准数据**,**不是** 不写 spec.dataset;
#     DiT data-free 路径不 dump 校准数据 —— `enable_dump` 显式设 `false`
#     (短路 prepare_calib_data,直接返回 {expert: None},避免无谓浮点推理);
#     `true` 仅在确需浮点推理 dump 校准数据时显式开启
#     (详见 msmodelslim-adapter-verification/references/dit/README.md 硬约束 #2);
#     spec.dataset **必须显式写**(省略会静默落到 Pydantic 默认值 mix_calib.jsonl,
#     那是 LLM 文本集、无 text 字段,会在 validate_calib_samples 处 fail-fast);
#   - 本模板仅展示 `linear_quant` 一种 process step;不展示 smooth / quarot /
#     iter_smooth / flex_smooth_quant / awq 等抑制/校准策略的 YAML 形态;
#     若引入,由 orchestrator 调 quantization-expert-experience-tuning-rules/
#     scripts/apply_rollback.py(整层回退)在 `spec.process` 中追加对应 step
#     后再回到 quantize-dit 执行。
#   - 对称/非对称:模板显式固化 symmetric: true(minmax);如需非对称,
#     先确认 msmodelslim 默认值再修改。
#   - 双专家模型(如 Wan2.2-T2V-A14B)的 expert key 须与 init_model 返回 dict 一一对应
#     ({"low_noise_model": ..., "high_noise_model": ...})。
#
# 注意:YAML 顶层除 apiversion / metadata / spec 外,**禁止**额外字段
# (model_family / inference_repo 不要写在顶层,
#  会被 MultimodalSDModelslimV1QuantConfig 的 Pydantic schema 拒绝)。
#  orchestrator 路由所需的 model_family / inference_repo
#  通过 analysis_result.yaml 与 subagent_io 协议字段传递。

apiversion: multimodal_sd_modelslim_v1

metadata:
  config_id: hunyuan_video_w8a8_dynamic    # 配置标识;不是 label,是 config_id
  score: 0.95
  verified_model_types:                    # 与主仓 hunyuan_video_w8a8f8_mxfp.yaml 对齐
    - HunyuanVideo
  label:
    w_bit: 8
    a_bit: 8
    is_sparse: false
    kv_cache: false                        # DiT 不依赖 KV cache
    fa_quant: false                        # 本阶段不启用 FA3(仅 linear_quant)

spec:
  # 本模板仅演示 `linear_quant` 一种 process step;如需叠加其它
  # 策略(smooth / quarot / fa3_quant / …),在下方追加对应 step 即可,
  # 各 step 的 `exclude` 互不影响,由 yaml_utils.merge_exclude 选择首个
  # 含 exclude 的 step 写入。
  process:
    - type: "linear_quant"
      qconfig:
        act:
          scope: "per_token"               # 匹配规则: dtype=int8 → scope=per_token, dtype=mxfp8 → scope=per_block
          dtype: "int8"
          symmetric: true
          method: "minmax"
        weight:
          scope: "per_channel"             # 匹配规则: dtype=int8 → scope=per_channel, dtype=mxfp8 → scope=per_block
          dtype: "int8"
          symmetric: true
          method: "minmax"
      include:
        - "*"
      exclude:                             # 按目标模型实际需要排除;HunyuanVideo 主仓排除 *mod*
        - "*mod*"

  # 校准 prompt 集:短名(在 msmodelslim/lab_calib/ 下解析)/ 绝对路径 / 相对路径。
  # 必填 —— 省略会落到默认 mix_calib.jsonl(LLM 文本集),DiT 上必失败。
  # 现成短名:hunyuanvideo | wan2_2_t2v | wan2_2_i2v | wan2_2_ti2v
  # 自建:目录内放一个 index.jsonl,每行至少含非空 text,I2V 追加 image(相对路径);
  #      模板见 assets/index.example.jsonl,说明见 assets/calib_dataset.md。
  dataset: hunyuanvideo

  # 默认 MindIE-SD 格式
  save:
    - type: "mindie_format_saver"
      part_file_size: 0

  multimodal_sd_config:
    # DiT data-free 路径不 dump 校准数据 —— 显式 enable_dump: false
    # (短路 prepare_calib_data,直接返回 {expert: None},避免无谓浮点推理);
    # true 仅在确需浮点推理 dump 校准数据时显式开启
    # (详见 msmodelslim-adapter-verification/references/dit/README.md 硬约束 #2)。
    dump_config:
      enable_dump: false
      capture_mode: "args"
      dump_data_dir: ""                    # 留空 → 默认 save_path

    # 重构路径统一使用 inference_config(Pydantic 校验,与原推理仓 parse_args 对齐)
    # 字段名 / 默认值 / 入口脚本 详见:
    #   ../../msmodelslim-model-adapt/references/dit/inference_config_field_map.md
    # 定位方法见 inference_repo 的 README.md。
    inference_config:
      model_resolution: "720p"             # HunyuanVideo hyvideo.config parse_args
      video_size: [720, 1280]              # (height, width)
      video_length: 129
      infer_steps: 50
      cfg_scale: 1.0
      embedded_cfg_scale: 6.0
      flow_shift: 7.0
      num_videos: 1
      batch_size: 1
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 197kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall