datapipes
Build and debug PhysicsNeMo reader-to-Dataset-to-DataLoader data pipelines for TensorDict, mesh, streaming, and Hydra-configured workflows.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- datapipes
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Build and debug PhysicsNeMo reader-to-Dataset-to-DataLoader data pipelines for TensorDict, mesh, streaming, and Hydra-configured workflows.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md3.5 KB
- 参考文档references/data-formats.md2.0 KB
- 参考文档references/datapipe-workflows.md2.1 KB
- 参考文档references/troubleshooting.md1.7 KB
- 脚本scripts/create_tiny_npz_datapipe.py2.8 KB
03 SKILL.md 正文
PhysicsNeMo Datapipes Operating Skill
Use this sub-skill when the user needs to load scientific ML data into PhysicsNeMo, build reader → dataset → transform → DataLoader workflows, validate TensorDict payloads, choose file formats, configure Hydra datapipes, or debug data-format/collation/device/streaming failures.
Trigger phrases
Use this sub-skill for requests that mention any of:
- PhysicsNeMo datapipes, readers,
Dataset,DataLoader,TensorDict,MultiDataset,MeshDataset, orIterableDatasetBase. - Loading NPZ/NumPy, HDF5, Zarr/TensorStore, VTK/STL,
.pmsh, or.pdmshdata into a model. Normalize,SubsamplePoints,Compose,KNearestNeighbors,MeshToTensorDict, custom readers/transforms/collators, Hydra${dp:...}configs, or data-pipeline reproducibility.- Errors involving missing fields, wrong file patterns, mismatched
TensorDictkeys/shapes, optional dependencies, CPU↔CUDA transfer, stream prefetching, or online/iterable generators.
Fast route
- Classify the data source. Use the reader selection notes below, then open references/data-formats.md for exact layout expectations.
- Build the smallest pipeline. Start with
Reader, inspectlen(reader),reader.field_names, andreader[0]; then wrap withDataset, thenDataLoader. Recipes are in references/datapipe-workflows.md. - Validate the payload. Confirm keys, shapes, dtypes, metadata, device, batch dimension, and collation strategy before connecting to a model.
- Add transforms last. Apply
Normalize,SubsamplePoints, spatial/mesh transforms, or custom transforms only after raw reader output is correct. Use references/api-reference.md for exact constructor names. - Debug synchronously first. For hard failures, set
prefetch_factor=0or callloader.disable_prefetch()before investigating CUDA streams or threaded I/O. See references/troubleshooting.md. - Run a tiny smoke when in doubt. The bundled helper scripts/create_tiny_npz_datapipe.py creates a temporary NPZ fixture and exercises
NumpyReader → Dataset → DataLoaderon CPU or CUDA.
Reader selection
- Single
.npzwith sample axis in the first dimension: useNumpyReader(path, fields=..., index_key=...). - Directory of
.npzsample files: useNumpyReader(directory, file_pattern="sample_*.npz", fields=...); this mode supports reader-side coordinated subsampling. - Single or directory HDF5: use
HDF5Reader; it reads root-level datasets by key and indexes the first dimension in single-file mode. - Zarr groups: use
ZarrReaderfor local Zarr groups, attributes-as-tensors, store caching, and single-group or directory mode. - Large/local Zarr with async reads: use
TensorStoreZarrReaderwhentensorstoreis installed and you want explicit cache/concurrency controls. - STL-style VTK surface samples: use
VTKReaderonly when the optional VTK/PyVista stack is installed and the sample directories contain supported mesh files. - Native PhysicsNeMo mesh archives: use
MeshReaderfor.pmshsingle meshes andDomainMeshReaderfor.pdmshdomain meshes; pair withMeshDatasetand mesh transforms. - No stable length or index: implement
IterableDatasetBaseand letDataLoaderuse the main-thread generator path.
Validation checklist
Before handing a datapipe to a training or inference loop, verify:
len(reader)is correct for map-style data, orlen(loader)intentionally raises for iterable data.reader.field_namesor the first sample contains the expected keys.reader[0]returns(TensorDict, metadata)for tensor readers, or(Mesh/DomainMesh, metadata)for mesh readers.Dataset(reader, device=...)moves tensors to the intended device before transforms.- Transform input keys exist and have compatible first dimensions for coordinated subsampling.
- The selected collator matches sample shape: default stacking for fixed shapes; concat/custom collation for variable-length point clouds or graph objects.
DataLoader(..., collate_metadata=True)returns metadata only if the training loop needs source indices, filenames, ordataset_index.seed=andloader.set_epoch(epoch)are used when stochastic readers/transforms must be reproducible.
Route to sibling sub-skills
- For which model family or example to pair with a datapipe, route to model-selection.
- For mesh creation, mesh validation, repair, geometry calculations, or mesh serialization beyond loading, route to mesh-and-geometry.
- For distributed samplers, DDP/FSDP2, ShardTensor, domain parallel input scatter, or multi-GPU launch issues, route to distributed-and-domain-parallel.
- For diffusion/generative datasets tied to sampler or preconditioner workflows, route to diffusion-and-generative after the data path is validated.
- For active-learning orchestration, logging/checkpoints, or ONNX export after data loading, route to active-learning-and-deployment.
Operating cautions
- Treat readers as CPU I/O adapters. Do not put GPU kernels, model calls, downloads, credential prompts, or long preprocessing inside a
Reader._load_sampleimplementation. - Transforms mutate/update
TensorDict-style payloads; order matters. - PhysicsNeMo's
DataLoaderis thread/stream oriented rather than PyTorch multiprocessing oriented. Pinned reader output plusdevice="cuda"is what enables asynchronous host-to-device transfer. - Never assume large domain examples are smoke tests. Use tiny generated fixtures for validation, then document external-data and optional-dependency requirements separately.
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).