graph-models
Build Graph Nets blocks and high-level Sonnet model architectures.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- graph-models
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Build Graph Nets blocks and high-level Sonnet model architectures.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/api-reference.md14.4 KB
- 参考文档references/troubleshooting.md9.7 KB
- 参考文档references/workflows.md11.7 KB
- 脚本scripts/demo_models_tf1.py7.1 KB
- 脚本scripts/demo_models_tf2.py6.6 KB
- 脚本scripts/graph_model_smoke.py6.2 KB
03 SKILL.md 正文
Graph Models
Use this sub-skill when the task is to assemble, adapt, or debug Graph Nets neural-network modules: low-level broadcasters/aggregators, EdgeBlock / NodeBlock / GlobalBlock, high-level graph_nets.modules architectures, or Sonnet model factories for Graph Nets demos.
Route here for
- Choosing and wiring
graph_nets.blocksbroadcasters, aggregators, reducers, or update blocks. - Building
GraphIndependent,GraphNetwork,InteractionNetwork,RelationNetwork,DeepSets,CommNet, orSelfAttentionmodules. - Writing Sonnet 1 or Sonnet 2
*_model_fnfactories for edge, node, global, encoder, core, decoder, or output transforms. - Adapting the bundled demo architectures in
scripts/demo_models_tf1.pyorscripts/demo_models_tf2.py. - Running a tiny installed-package model smoke with
scripts/graph_model_smoke.py.
Route elsewhere
- Raw
GraphsTupleconstruction, dictionary batching, and NetworkX conversion belong in../graph-data/SKILL.md. - TensorFlow utilities, placeholders, padding, masks,
utils_tf.concat,tf.functionsignatures, and session/feed details belong in../tensorflow-ops/SKILL.md. - Full training-loop or notebook reproduction work should use the root Graph Nets recipe guidance first, then return here only for the model/module layer.
Required reading for model work
references/api-reference.mdfor constructor contracts, field requirements, reducer defaults, and Sonnet version differences.references/workflows.mdfor practical recipes: independent encoders/decoders, generic message passing, relation/set/communication modules, self-attention, and encode-process-decode.references/troubleshooting.mdwhen a graph field isNone, senders/receivers are absent, reducers are missing, concatenation shapes fail, or TF/Sonnet major versions mismatch.
Operating checklist
- Confirm the installed stack before choosing code style: Sonnet 1 uses
snt.AbstractModuleand TF1 sessions/placeholders; Sonnet 2 usessnt.Module, eager tensors, and optionaltf.functionwrapping. - Decide which graph fields the module is allowed to read. Match every
use_*flag to non-Noneinput fields and to required reducers. - Keep model factories as zero-argument callables that return a Sonnet module or callable. Do not instantiate a fresh submodule inside every call of an already-built model.
- Validate all concatenated features share the same rank and all non-last axes after broadcasting/aggregation; only the last feature axis should differ.
- Preserve sub-skill boundaries: fix invalid graph data before model assembly and delegate padding/session mechanics to the TensorFlow ops sub-skill.
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).