nemo_automodel.components.datasets.vlm.pp_media
nemo_automodel.components.datasets.vlm.pp_media
Module Contents
Functions
Data
API
Return whether the next schedule step will probe stage 0 with a real forward.
Both the legacy _configure_outputs_meta API and the newer populated
_user_meta API provide analytical stage metadata, so neither needs a
forward probe. An unpopulated _user_meta still uses dynamic inference.
Chunk image tensors with per-sample patch counts for PP microbatches.
Step3 processors emit one full image per sample in pixel_values and a
flat list of optional crop patches in patch_pixel_values. num_patches
maps samples to the flat patch tensor. Processors may also emit
pixel_values itself as a flat patch tensor using the same mapping.
Parameters:
Either [batch, ...] (one image tensor per sample) or a
row-flattened [total_patches, ...] tensor whose patches are
concatenated along axis 0 in sample order, where
total_patches == sum(num_patches).
Number of samples in the batch.
Number of PP microbatches to split the batch into.
Tensor of shape [batch]; entry i is the patch count
for sample i. Defaults to all-zeros when the processor emits no
crop patches.
Optional row-flattened crop patches of shape
[total_patches, ...] indexed by num_patches.
Optional tensor of shape [total_patches] marking
patch-row newline positions, indexed by num_patches.
Returns: dict[str, list[torch.Tensor]]
dict[str, list[torch.Tensor]]: Per-microbatch slices keyed by
Split VLM pixel values and media metadata into PP microbatch chunks.
Handles four layouts:
[N, C, H, W]withN == batch_size— one full image per sample.[N, max_patches, D]withN == batch_size— padded patches per image.- Flat patches
[total_patches, D]with per-sample media counts fromn_images_per_sample. - Flat patches with
n_images == batch_size— legacy one-image-per-sample.
Move VLM media tensors into pre-chunked PP media storage on the batch.
This is intended to run from VLM collate/dataloader code when PP is enabled.
The returned batch no longer carries raw media tensors that PyTorch PP would
chunk by row incorrectly; instead it carries VLM_PP_MEDIA_KEY with
per-microbatch media chunks.
Attach dataloader-prepared VLM media chunks to PP stage 0 for one schedule call.
Wrap a VLM collate function so it prepares media tensors for PP.