numpyro
Route NumPyro probabilistic programming tasks across modeling primitives, distributions, MCMC diagnostics, SVI/autoguides, JAX backends, and optional contrib workflows.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- numpyro
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Route NumPyro probabilistic programming tasks across modeling primitives, distributions, MCMC diagnostics, SVI/autoguides, JAX backends, and optional contrib workflows.
- disable-model-invocation
- true
02 资源文件 7
- 参考文档references/getting-started.md4.1 KB
- 参考文档references/repo-provenance.md1.6 KB
- 参考文档references/repo-routing-metadata.json335 B
- 参考文档references/source-artifact-map.md3.3 KB
- 参考文档references/troubleshooting.md4.3 KB
- 脚本scripts/api_quick_probe.py2.5 KB
- 脚本scripts/check_numpyro_environment.py5.8 KB
03 SKILL.md 正文
NumPyro repo skill
Use this repo skill when a task involves NumPyro, the JAX-backed probabilistic programming package: writing models with Pyro-like primitives, choosing distributions and transforms, running MCMC or SVI, diagnosing posterior geometry, configuring JAX CPU/GPU/TPU execution, or deciding whether an optional numpyro.contrib workflow is needed.
First checks
- Package/import name:
numpyro - Supported Python from package metadata: Python
>=3.11 - Minimal install:
pip install numpyro - CPU-pinned install when JAX compatibility is confusing:
pip install 'numpyro[cpu]' - CUDA installs are optional and must match JAX's current NVIDIA wheel guidance:
pip install 'numpyro[cuda12]' -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html pip install 'numpyro[cuda13]' -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html - Minimal import/backend check:
import jax import numpyro import numpyro.distributions as dist print(numpyro.__version__, jax.default_backend(), jax.devices())
For a stronger environment diagnostic, run scripts/check_numpyro_environment.py. For a concise API/signature probe, run scripts/api_quick_probe.py.
Route by task
| User task or signal | Read |
|---|---|
Write a model, inspect sample/param sites, condition/seed/trace, fix plate placement, use effect handlers, render or inspect model relations, handle JAX-compatible control flow. |
modeling-primitives |
Choose or debug distributions, constraints, batch_shape/event_shape, to_event, Independent, TransformedDistribution, transforms, support validation, finite log_prob. |
distributions-transforms |
Run NUTS/HMC/MCMC, choose kernels, collect extra fields, interpret divergences/ESS/r_hat, run posterior predictive or log likelihood, configure chains/devices/x64. |
mcmc-diagnostics |
| Fit SVI, write a guide, choose ELBOs, use autoguides, debug guide parameters/losses, use discrete enumeration with SVI. | svi-autoguides |
| Use optional contrib areas: Funsor enumeration helpers, HSGP, nested sampling, SteinVI/SVGD, Flax/NNX/Equinox module wrappers, TFP wrappers, stochastic-support inference. | advanced-contrib |
Shared references
- Getting started explains the package mental model, install variants, minimal smoke checks, and common workflow sequence.
- Cross-cutting troubleshooting covers install/import, JAX backend, optional dependencies, data downloads, dtype/precision, compilation, and source-versus-installed-package pitfalls.
- Source artifact map records which original docs/examples/scripts were distilled into bundled runtime references or helper scripts.
- Repository provenance records the source version and evidence baseline for refresh decisions.
- Router metadata is consumed by the managed repo-skills-router importer.
Operating guidance
- Start with the sub-skill closest to the user's task. Do not open optional contrib guidance for ordinary core MCMC/SVI/distribution questions unless the task names a contrib API or optional dependency.
- Validate a model in layers: distribution object checks, model trace/plate checks, then inference smoke. This prevents blaming MCMC/SVI for support or shape errors.
- Treat GPU/TPU as optional acceleration unless the user explicitly requires accelerator verification. A CPU run verifies NumPyro semantics but not CUDA/TPU wheel compatibility.
- Keep examples tiny while diagnosing. NumPyro/JAX first-run compilation can dominate small runs; distinguish compile latency from sampling/optimization failure.
- Do not make runtime work depend on the original repository checkout. Use the bundled references and scripts in this skill tree, plus an installed NumPyro package.
Common bundled scripts
python scripts/check_numpyro_environment.py --prettychecks core imports, JAX backend, and selected optional dependencies without requiring the source repo.python scripts/api_quick_probe.py --prettyprints key public signatures for primitives, inference classes, autoguides, and utilities.- Sub-skill scripts provide focused smokes for tracing, distributions/transforms, MCMC, SVI, and optional dependency probing.
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).