kali20gakki/msAgent / skills/quantizer/msmodelslim-anti-outlier-adapt
msmodelslim-anti-outlier-adapt
Verified在基础模型适配完成后,按算法适配并安装 Adapter 接口,依据目标模型真实 forward 生成并验证 final-logits patch,执行单算法 msModelSlim 离群值抑制变换、官方计算图提取和浮点 logits 门禁。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.4 KB |
| references/architecture-analysis.md | markdown | 1.8 KB |
| references/audit-report.md | markdown | 763 B |
| references/interface-quick-reference.md | markdown | 14.4 KB |
| references/quarot-adaptation.md | markdown | 1.3 KB |
| references/smoothing-adaptation.md | markdown | 1.5 KB |
| references/topology-patterns.md | markdown | 806 B |
| references/validation.md | markdown | 6.0 KB |
| scripts/apply_one_anti_outlier.py | script | 44.2 KB |
| scripts/compare_final_logits.py | script | 32.0 KB |
| scripts/validate_anti_outlier_interfaces.py | script | 8.8 KB |
references/architecture-analysis.md
View on GitHub# 使用 msModelSlim 提取模型结构
模型结构提取以用户当前环境中已安装的 msModelSlim `fast_ops_grapher` 公共 Python API 为
实现依据。用 Python `inspect.signature`、`help` 或实际导入核对可用接口,不依赖 msModelSlim
源码 checkout,也不得引用其 `docs/zh` 文档。msAgent 不维护自研 AST 扫描、hook、FX tracing
或图 formatter 脚本。
## 官方能力
导入入口:
```python
from msmodelslim.core.graph.fast_ops_grapher import (
NativeModuleExtractor,
TransformerAutoExtractor,
TransformerExtractor,
)
```
按模型状态选择:
- 只有模型路径:`TransformerAutoExtractor.create(model_path, trust_remote_code, device, revision)`;
- 已加载 Transformers 模型和 tokenizer:`TransformerExtractor.create(model, tokenizer)`;
- 自定义或非 Transformers `nn.Module`:`NativeModuleExtractor.create(module, args, kwargs)`。
统一调用:
```python
graph = extractor.extract_dag()
dot_str = graph.format("dot")
```
将官方 formatter 的结果按算法保存为 `anti_outlier_graph.<algorithm>.dot`。需要程序内核对时直接使用
`ComputationGraph.iter_nodes()`、`iter_edges()`、`GraphNode.get_successors()` 和
`get_predecessors()`,不得为此新增 msAgent 结构提取脚本。
## 图信息核对
官方图节点提供 operator 记录,边提供 tensor 数据流。核对离群值抑制关系时关注:
- operator name 与 traceback 对应的真实模块;
- tensor varname、dtype 和 shape;
- norm、attention、MLP、expert、残差流之间的前驱/后继;
- GQA/MLA、融合 QKV、VLM merger、MTP 等分支是否实际出现在执行图中。
无法由默认 dummy input 覆盖的动态分支,应调整官方 Extractor 的合法输入或使用
`NativeModuleExtractor`,并在交付说明中记录覆盖限制;不得退回自研静态扫描脚本。
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: 198k | 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 |