用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/HorizonRobotics/OE-Skills --skill lightcompress-quant-explore命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | lightcompress-quant-explore |
| version | 2.0.3 |
| description | 执行 LightCompress 量化实验并生成精度报告。当用户要求运行量化实验、量化精度测试或 PPL 评估时触发。 |
调用 prepare_experiment.py 创建实验目录和 YAML 配置:
python {skill_dir}/scripts/prepare_experiment.py \
--model /path/to/model \
--model-type Qwen2 \
--method smoothquant \
--w-bit 8 \
--a-bit 8
注意:不指定
--workspace时,脚本默认使用{当前工作目录}/experiments作为输出目录。
脚本输出 JSON 包含:
experiment_dir: 实验目录路径config_path: YAML 配置路径yaml_content: 完整 YAML 配置内容向用户展示完整的 YAML 配置内容,让用户检查是否符合预期。
使用 AskUserQuestion 询问:开始实验 / 取消
用户确认后,调用 execute_experiment.py 执行实验:
python {skill_dir}/scripts/execute_experiment.py {experiment_dir}
实验成功后,检查 <project_root>/.claude/skills/quant-accuracy-cache/ 是否存在:
quant-accuracy-cache skill 保存结果| 参数 | 必需 | 说明 | 默认值 |
|---|---|---|---|
--model | ✅ | 模型路径 | - |
--model-type | ✅ | 模型类型 | - |
--method | ✅ | 量化方法 | - |
--w-bit | 权重量化位宽 | 4 | |
--a-bit | 激活量化位宽 | 8 | |
--fast-mode | 快速验证模式 | false | |
--save-artifacts | 保存量化产物 | false | |
--workspace | 工作目录 | ./experiments | |
--mix-bits | 混合精度组(可多次),见下方示例 | - | |
--special | 覆盖 quant.special 参数(可多次),KEY=VAL | - | |
--calib-path | 校准数据集路径 | 内置 wikitext2_calib | |
--calib-name | 校准数据集名 | wikitext2 | |
--calib-n-samples | 校准样本数(显式值不被显存降级) | 自动 | |
--calib-seq-len | 校准序列长度 | 模板默认 | |
--calib-preproc | 校准预处理 | wikitext2_gptq | |
--eval-path | 评估数据集路径 | 内置 wikitext2_eval | |
--eval-seq-len | 评估序列长度 | 模板默认 | |
--no-eval-pretrain | 只评 fake_quant,跳过 pretrain | false | |
--inference-per-block | 逐 block 推理评测(大模型省显存) | false | |
--save-path | fakequant 保存路径(指定即开 save_fake) | - |
将 q/o_proj + MoE expert 设为 W4、其余 W8(Gemma4Moe 常用):
python {skill_dir}/scripts/prepare_experiment.py \
--model /jfs-public/openexplorer_llm/models/gemma-4-26B-A4B-it \
--model-type Gemma4Moe --method gptq --w-bit 8 --a-bit 8 \
--mix-bits "name=qo_experts_w4;bit=4;layers=self_attn.q_proj,self_attn.o_proj,experts.experts.*.gate_proj,experts.experts.*.up_proj,experts.experts.*.down_proj" \
--calib-n-samples 256 --calib-seq-len 1024 \
--no-eval-pretrain --inference-per-block \
--save-path /path/to/save/ \
--env-activate ~/miniconda3/etc/profile.d/conda.sh
--mix-bits 格式:"name=组名;bit=位宽;layers=层1,层2,...",层名支持通配符 *(如 experts.experts.*.gate_proj)。多组混合精度可多次传 --mix-bits。--w-bit 位宽。| 模型系列 | type 值 |
|---|---|
| Qwen | Qwen, Qwen2, Qwen3, Qwen3Moe |
| InternVL | InternVL2, InternVL3_5 |
| DeepSeek | DeepSeekV2, DeepSeekV3 |
| Gemma4 | Gemma4, Gemma4Moe(MoE 自动识别 num_experts) |
| 文件 | 用途 |
|---|---|
| base_template.yml | YAML 模板 |
| methods_config.yml | 量化方法参数 |
| pretrain_accuracy_cache.yml | pretrain 缓存 |