modeling-and-layers
Understand Scenic model registry contracts, BaseModel task bases, Flax module construction, layers, attention, matchers, and tiny smoke checks.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- modeling-and-layers
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Understand Scenic model registry contracts, BaseModel task bases, Flax module construction, layers, attention, matchers, and tiny smoke checks.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/layers-and-matchers.md6.0 KB
- 参考文档references/modeling-api.md6.4 KB
- 参考文档references/troubleshooting.md3.8 KB
- 脚本scripts/model_registry_probe.py1.8 KB
03 SKILL.md 正文
Modeling and Layers
Use this sub-skill when the task is about Scenic model selection, BaseModel contracts, task-specific model bases, Flax module construction, layer/attention/matcher APIs, or tiny smoke checks.
Start here
- Read
references/modeling-api.mdfor the registry, model-class contracts, loss/metric conventions, and model-init/apply patterns. - Read
references/layers-and-matchers.mdfor attention/layer/matcher APIs, optional dependencies, and tiny validation patterns. - Read
references/troubleshooting.mdwhen a model name is missing, a Flax/JAX shape or RNG issue appears, metrics aggregate incorrectly, or a checkpoint does not load cleanly. - Run
scripts/model_registry_probe.pyto list registered model names or resolve a single model class without instantiating it.
Scope and routing
- In scope: model registry lookups, BaseModel and task-base contracts, loss/metric normalization, Flax module construction, layer/attention/matcher APIs, and smoke-test patterns for tiny inputs.
- Out of scope: training orchestration, launch commands, schedules, checkpoint lifecycle, dataset builders, project selection, and paper/baseline choice.
- Route training/runtime execution to
running-and-training. - Route dataset builders and input-pipeline work to
data-pipelines. - Route project-level or paper-level model selection to
baselines-and-projects.
Operating rules
- Begin with the registry; an unrecognized model name is usually a registry or config problem, not a training problem.
- Treat
build_flax_model()as the construction boundary. Build the Flax module, then use tinyinit/applychecks instead of a full run. - Keep loss functions local and scalar; keep metrics cross-device safe by returning sum/normalizer pairs.
- Use tiny dummy inputs for smoke checks and shape assertions. Prefer
init_with_output,init, andapplyon minimal batches. - Keep optional matcher dependencies explicit. Do not promise
scipyorott-jaxbehavior unless the target matcher requires it.
When to read what
| Need | Read |
|---|---|
| Registry, BaseModel, task bases, loss/metric rules, smoke-init pattern | references/modeling-api.md |
| Attention, layer, masked-layer, and matcher APIs plus tiny validation patterns | references/layers-and-matchers.md |
| Common failure modes and recovery | references/troubleshooting.md |
| List registered models or resolve one class | scripts/model_registry_probe.py |
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).