diagnostics-and-serialization
Use Equinox serialization, runtime errors, debug tools, pretty printing, enumerations, and progress meters.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- diagnostics-and-serialization
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use Equinox serialization, runtime errors, debug tools, pretty printing, enumerations, and progress meters.
- disable-model-invocation
- true
02 资源文件 2
- 参考文档references/diagnostics-and-serialization.md4.5 KB
- 参考文档references/troubleshooting.md3.3 KB
03 SKILL.md 正文
Diagnostics and Serialization
Use this sub-skill for saving/loading PyTrees, runtime checks, debugging JAX transforms, pretty-printing modules, enumerations, progress meters, and cache maintenance.
Use when
- The user needs
tree_serialise_leaves,tree_deserialise_leaves, or custom serialization filter specs. - A task asks about runtime checks with
error_iforbranched_error_if. - A JAX/Equinox program has NaNs, repeated tracing, dead-code elimination, or confusing transformed error output.
- The user needs
tree_pformat,tree_pprint,Enumeration,clear_caches, or progress meter utilities. - The task asks whether ONNX export is supported by the current repo evidence.
Route elsewhere
- Use
../module-and-trees/for model field definitions, PyTree partitioning,tree_at, ortree_checkas model-construction tools. - Use
../filtered-transformations/when the main task is compiling, differentiating, vmapping, pmapping, or sharding a mixed PyTree. - Use
../nn-and-state/for layers, training/evaluation state, dropout,BatchNorm, or tied weights. - Use
../internal-advanced/forequinox.internalloops, primitive helpers, ornoinline.
Read first
references/diagnostics-and-serialization.mdfor patterns and API usage.references/troubleshooting.mdfor serialization, runtime error, debug, and optional dependency failures.../../references/troubleshooting.mdfor cross-cutting install/backend notes.
Core workflow
- For save/load tasks, identify the full PyTree structure and construct a like-tree for deserialization.
- Use
tree_serialise_leavesto write serializable leaves andtree_deserialise_leaveswith the like-tree to restore them. - Use custom filter specs only when the default array/scalar behavior is not enough.
- For runtime validation inside transformed code, use
eqx.error_iforeqx.branched_error_ifinstead of ordinary Python exceptions. - For NaN and recompilation debugging, use
eqx.debug.backward_nan,eqx.debug.assert_max_traces,jax.debug.print, and targeted environment variables. - Use
tree_pformat/tree_pprintfor readable module and shape diagnostics.
Minimal validation
From the generated skill root (set EQUINOX_SKILL_ROOT to its absolute path),
run:
cd "$EQUINOX_SKILL_ROOT" && python scripts/smoke.py --mode diagnostics
This validates a tiny leaf serialization round-trip, a false runtime-error branch, pretty printing, and trace counting.
Scope note
This sub-skill distills Equinox's serialization, runtime-error, and diagnostics workflows into the bundled references and smoke helper. The source repository's tests and docs were construction evidence only, not runtime dependencies.
Key cautions
- Deserialization is structure-sensitive; the like-tree controls structure and non-serialized leaves.
eqx.error_ifcan raise from within JIT/lax regions, but JAX may wrap the visible error text.- Prefer
EQX_ON_ERRORfor breakpoint-mode runtime-error debugging;on_error=is a per-call override, butbreakpointis safest via the environment variable. - Keep the return value from
error_if/branched_error_ifin the computation; if you drop it, JAX can dead-code-eliminate the check. tqdmis optional and only needed for the tqdm progress meter.- ONNX export is not treated as a verified runtime capability because the repo’s
ONNX test is skipped due an upstream
tf2onnxissue.
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).