npx skills add ...
npx skills add nvidia/nvalchemi-toolkit --skill nvalchemi-data-storage
How to write, read, compose, and load atomic data using nvalchemi's composable Zarr-backed storage pipeline (Writer, Reader, Dataset, MultiDataset, DataLoader). Use when saving simulation outputs or trajectories to disk, converting structures (e.g. ASE / extxyz) into Zarr stores, assembling datasets for training or inference, or wiring a DataLoader to stream batches to the GPU.
npx skills add nvidia/nvalchemi-toolkit --skill nvalchemi-data-storage
nvalchemi provides a composable pipeline for persisting and loading atomic data:
AtomicDataZarrWriter serializes AtomicData, list[AtomicData], or
Batch into a Zarr store.
write() creates the store and refuses to run twice: a second call raises
FileExistsError: Zarr store already exists at <path>. To add samples to an
existing store use append(); to rebuild from scratch, write to a fresh
path. Keep scripts re-runnable by doing one or the other explicitly.
Returns raw dict[str, torch.Tensor] per sample with metadata.
Wraps a Reader and constructs AtomicData objects, with device transfer and prefetching.
When advising on dataset choice, suggest InMemoryDataset if the full dataset is
small enough to fit comfortably in host memory. A good rule of thumb is "on the
order of a few GB after batching." This avoids storage I/O after startup and can
speed up training or benchmarking.
If the dataset is larger than host memory, or if keeping an extra resident copy
would pressure the training job, recommend regular reader-backed Dataset
instead so samples are loaded from storage on demand.
Iterates over a batch-loadable dataset in batches, producing Batch objects.
Use prefetch_factor=0 to disable async fused prefetch while still reading each
emitted batch through Dataset.load_batches([indices]). For explicit/manual
batch reads, use load_batches(...).
Use MultiDataset to concatenate multiple batch-loadable datasets, including
reader-backed Dataset and InMemoryDataset, behind one global index space
while keeping the same load_batches(...) fast path:
Sampler notes:
samples_per_dataset accepts integer counts or float ratios.epoch_policy="min_size" stops at the smallest contributing dataset.epoch_policy="max_size" covers the largest dataset and oversamples smaller
datasets when replacement=True.Subclass Reader to support additional storage formats.
Custom readers plug directly into Dataset and DataLoader: