AGENT SKILL

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

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_if or branched_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, or tree_check as 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/ for equinox.internal loops, primitive helpers, or noinline.

Read first

Core workflow

  1. For save/load tasks, identify the full PyTree structure and construct a like-tree for deserialization.
  2. Use tree_serialise_leaves to write serializable leaves and tree_deserialise_leaves with the like-tree to restore them.
  3. Use custom filter specs only when the default array/scalar behavior is not enough.
  4. For runtime validation inside transformed code, use eqx.error_if or eqx.branched_error_if instead of ordinary Python exceptions.
  5. For NaN and recompilation debugging, use eqx.debug.backward_nan, eqx.debug.assert_max_traces, jax.debug.print, and targeted environment variables.
  6. Use tree_pformat/tree_pprint for 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_if can raise from within JIT/lax regions, but JAX may wrap the visible error text.
  • Prefer EQX_ON_ERROR for breakpoint-mode runtime-error debugging; on_error= is a per-call override, but breakpoint is safest via the environment variable.
  • Keep the return value from error_if/branched_error_if in the computation; if you drop it, JAX can dead-code-eliminate the check.
  • tqdm is 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 tf2onnx issue.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351