Skip to content
Back to skills

Datapipes

ASecurity

"Build and debug PhysicsNeMo reader-to-Dataset-to-DataLoader data

  • 247 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 8, 2026
devopsapi

Works with

  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill datapipes --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Datapipes?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Datapipes
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-datapipes/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-datapipes)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: datapipes
description: "Build and debug PhysicsNeMo reader-to-Dataset-to-DataLoader data
  pipelines for TensorDict, mesh, streaming, and Hydra-configured workflows."
metadata:
  disco-role: operating
disable-model-invocation: true
license: Apache 2.0
---

# 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`, or `IterableDatasetBase`.
- Loading NPZ/NumPy, HDF5, Zarr/TensorStore, VTK/STL, `.pmsh`, or `.pdmsh` data 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 `TensorDict` keys/shapes, optional dependencies, CPU↔CUDA transfer, stream prefetching, or online/iterable generators.

## Fast route

1. **Classify the data source.** Use the reader selection notes below, then open [references/data-formats.md](references/data-formats.md) for exact layout expectations.
2. **Build the smallest pipeline.** Start with `Reader`, inspect `len(reader)`, `reader.field_names`, and `reader[0]`; then wrap with `Dataset`, then `DataLoader`. Recipes are in [references/datapipe-workflows.md](references/datapipe-workflows.md).
3. **Validate the payload.** Confirm keys, shapes, dtypes, metadata, device, batch dimension, and collation strategy before connecting to a model.
4. **Add transforms last.** Apply `Normalize`, `SubsamplePoints`, spatial/mesh transforms, or custom transforms only after raw reader output is correct. Use [references/api-reference.md](references/api-reference.md) for exact constructor names.
5. **Debug synchronously first.** For hard failures, set `prefetch_factor=0` or call `loader.disable_prefetch()` before investigating CUDA streams or threaded I/O. See [references/troubleshooting.md](references/troubleshooting.md).
6. **Run a tiny smoke when in doubt.** The bundled helper [scripts/create_tiny_npz_datapipe.py](scripts/create_tiny_npz_datapipe.py) creates a temporary NPZ fixture and exercises `NumpyReader → Dataset → DataLoader` on CPU or CUDA.

## Reader selection

- **Single `.npz` with sample axis in the first dimension:** use `NumpyReader(path, fields=..., index_key=...)`.
- **Directory of `.npz` sample files:** use `NumpyReader(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 `ZarrReader` for local Zarr groups, attributes-as-tensors, store caching, and single-group or directory mode.
- **Large/local Zarr with async reads:** use `TensorStoreZarrReader` when `tensorstore` is installed and you want explicit cache/concurrency controls.
- **STL-style VTK surface samples:** use `VTKReader` only when the optional VTK/PyVista stack is installed and the sample directories contain supported mesh files.
- **Native PhysicsNeMo mesh archives:** use `MeshReader` for `.pmsh` single meshes and `DomainMeshReader` for `.pdmsh` domain meshes; pair with `MeshDataset` and mesh transforms.
- **No stable length or index:** implement `IterableDatasetBase` and let `DataLoader` use 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, or `len(loader)` intentionally raises for iterable data.
- `reader.field_names` or 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, or `dataset_index`.
- `seed=` and `loader.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](../model-selection/SKILL.md).
- For **mesh creation, mesh validation, repair, geometry calculations, or mesh serialization beyond loading**, route to [mesh-and-geometry](../mesh-and-geometry/SKILL.md).
- For **distributed samplers, DDP/FSDP2, ShardTensor, domain parallel input scatter, or multi-GPU launch issues**, route to [distributed-and-domain-parallel](../distributed-and-domain-parallel/SKILL.md).
- For **diffusion/generative datasets tied to sampler or preconditioner workflows**, route to [diffusion-and-generative](../diffusion-and-generative/SKILL.md) after the data path is validated.
- For **active-learning orchestration, logging/checkpoints, or ONNX export after data loading**, route to [active-learning-and-deployment](../active-learning-and-deployment/SKILL.md).

## 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_sample` implementation.
- Transforms mutate/update `TensorDict`-style payloads; order matters.
- PhysicsNeMo's `DataLoader` is thread/stream oriented rather than PyTorch multiprocessing oriented. Pinned reader output plus `device="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.

Files in this skill

  • SKILL.md6.1 KB
  • references/api-reference.md3.5 KB
  • references/data-formats.md2 KB
  • references/datapipe-workflows.md2.1 KB
  • references/troubleshooting.md1.7 KB
  • scripts/create_tiny_npz_datapipe.py2.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.