Ascend/msagent / skills/quantizer/msmodelslim-adapter-verification
msmodelslim-adapter-verification
Verified为 msModelSlim 适配器执行功能性验证。适用于基础适配器开发完成后,自动执行四步验证(测试模型、全回退量化、权重一致性与可加载/保存、实际量化规则校验)并输出通过/失败结论。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 7.6 KB |
| references/dit/README.md | markdown | 3.2 KB |
| references/dit/fallback_config.yaml | config | 1.5 KB |
| references/dit/index.example.jsonl | other | 1.4 KB |
| references/dit/w8a8_dynamic_full_model.yaml | config | 1.3 KB |
| references/dit/w8a8_mxfp8_full_model.yaml | config | 1.6 KB |
| references/llm/fallback_config.yaml | config | 473 B |
| references/llm/w8a8_dynamic_full_model.yaml | config | 497 B |
| references/llm/w8a8_static_full_model.yaml | config | 497 B |
| references/verification_guide.md | markdown | 8.5 KB |
| references/vlm/fallback_config.yaml | config | 562 B |
| references/vlm/w8a8_dynamic_full_model.yaml | config | 652 B |
| references/vlm/w8a8_static_full_model.yaml | config | 652 B |
| scripts/step1_generate_test_model.py | script | 8.5 KB |
| scripts/step2_run_quantization.py | script | 2.7 KB |
| scripts/step2_run_quantization_dit.py | script | 13.7 KB |
| scripts/step3_verify_weights.py | script | 2.4 KB |
| scripts/step4_verify_quant_description.py | script | 4.3 KB |
scripts/step2_run_quantization.py
View on GitHub#!/usr/bin/env python3
"""步骤2:执行全回退量化(精简版,支持 LLM/VLM)。
DiT 请用 step2_run_quantization_dit.py。
"""
import argparse
import os
import subprocess
import sys
LLM_FALLBACK_YAML = """apiversion: modelslim_v1
spec:
process:
- type: "linear_quant"
qconfig:
act:
scope: "per_token"
dtype: "int8"
symmetric: True
method: "minmax"
weight:
scope: "per_channel"
dtype: "int8"
symmetric: True
method: "minmax"
include: ["*"]
exclude: ["*"]
save:
- type: "ascendv1_saver"
part_file_size: 4
"""
VLM_FALLBACK_YAML = """apiversion: multimodal_vlm_modelslim_v1
spec:
process:
- type: "linear_quant"
qconfig:
act:
scope: "per_token"
dtype: "int8"
symmetric: True
method: "minmax"
weight:
scope: "per_channel"
dtype: "int8"
symmetric: True
method: "minmax"
include: ["*"]
exclude: ["*"]
save:
- type: "ascendv1_saver"
part_file_size: 4
dataset: "calibImages"
default_text: "Describe this image in detail."
"""
def _write_fallback_yaml(path, model_family: str):
os.makedirs(os.path.dirname(path) or ".", exist_ok=True)
content = VLM_FALLBACK_YAML if model_family == "vlm" else LLM_FALLBACK_YAML
with open(path, "w", encoding="utf-8") as f:
f.write(content)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--model-path", required=True)
parser.add_argument("--output-path", required=True)
parser.add_argument("--model-type", required=True)
parser.add_argument("--device", default="cpu")
parser.add_argument("--config-path", default="")
parser.add_argument("--model-family", choices=["llm", "vlm"], default="llm")
args = parser.parse_args()
config_path = args.config_path or os.path.join(args.output_path, "fallback_config.yaml")
if not os.path.exists(config_path):
_write_fallback_yaml(config_path, args.model_family)
os.makedirs(args.output_path, exist_ok=True)
cmd = [
sys.executable,
"-m",
"msmodelslim",
"quant",
"--model_path",
args.model_path,
"--save_path",
args.output_path,
"--device",
args.device,
"--model_type",
args.model_type,
"--config_path",
config_path,
"--trust_remote_code",
"True",
]
rc = subprocess.run(cmd, check=False).returncode
if rc != 0:
print("[ERROR] step2失败")
return rc
print(f"[OK] step2完成: {args.output_path}")
return 0
if __name__ == "__main__":
sys.exit(main())Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 197k | Updated | Claude CodeCodex | Verified | Install |
| 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: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| 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: 194k | Updated | Claude CodeCodex | Verified | Install |