neuron-view
Route BertViz neuron_view query/key neuron inspection workflows.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- neuron-view
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Route BertViz neuron_view query/key neuron inspection workflows.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md6.4 KB
- 参考文档references/model-compatibility.md4.5 KB
- 参考文档references/troubleshooting.md3.3 KB
- 参考文档references/workflows.md3.9 KB
- 脚本scripts/validate_toy_bert_attention.py9.2 KB
03 SKILL.md 正文
neuron-view
Use this sub-skill when a BertViz task needs the neuron view: per-head attention plus the query and key vectors that produced each attention score.
Route here when
- You need
bertviz.neuron_view.showto render the interactive neuron view in a notebook, Colab, or saved HTML workflow. - You need
bertviz.neuron_view.get_attentionto compute the serialized attention/query/key payload for validation, custom inspection, or debugging. - You need BertViz's vendored modified Transformer classes from
bertviz.transformers_neuron_viewbecause ordinary Hugging Face models do not expose query/key vectors in the schema expected by neuron view. - You need sentence-pair neuron-view slicing for BERT or RoBERTa, or you need to explain why GPT-2 and XLNet sentence pairs fail.
- You need an offline toy BERT validation path that avoids pretrained model downloads.
Do not route here when
- The user already has attention tensors and only wants head view or model view rendering; use
../attention-views/SKILL.md. - The task is generic Transformers fine-tuning, training, checkpoint serving, generation, or deployment.
- The task asks for encoder-decoder, cross-attention, or tensor-only head/model view workflows; use
../attention-views/SKILL.md. - The task requires interpreting attention as a causal explanation of model predictions; this skill only operates BertViz neuron-view mechanics.
Start with
references/api-reference.mdfor signatures,model_typevalues, output schema, and token partition behavior.references/workflows.mdfor BERT, GPT-2, RoBERTa, toy validation, HTML export, and offline/cache-first recipes.references/model-compatibility.mdfor vendored class choices, sentence-pair support, optional dependencies, and CPU expectations.references/troubleshooting.mdfor common errors and recovery steps.scripts/validate_toy_bert_attention.pyfor no-network local validation ofget_attentionbehavior.
Routing shortcuts
- Use
show(...)for display/export; it callsget_attention(..., include_queries_and_keys=True)internally and injects the payload into BertViz HTML/JavaScript. - Use
get_attention(...)for assertions, schema inspection, and non-display workflows. - Valid
model_typestrings are exactlybert,gpt2,xlnet, androberta; they are not inferred from the model class. - BERT and RoBERTa support sentence-pair partitions (
all,aa,ab,ba,bb); GPT-2 sentence pairs raiseValueError; XLNet sentence pairs raiseNotImplementedError. - Keep core neuron-view validation CPU-local and no-network whenever possible. Prefer the bundled toy script before trying remote pretrained notebooks or uncached
from_pretrained(...)calls. - If the workflow does not need query/key vectors, route to
../attention-views/SKILL.mdinstead of forcing vendored neuron-view models.
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).