nemo_automodel.components.datasets.diffusion.image_edit_dataset
nemo_automodel.components.datasets.diffusion.image_edit_dataset
Cached, model-agnostic image-edit datasets and dataloaders.
Module Contents
Classes
Functions
Data
API
Construction-time configuration for a cached image-edit dataloader.
Build the configured dataset, bucket sampler, and stateful dataloader.
Parameters:
Data-parallel rank that consumes the dataloader.
Number of data-parallel ranks.
Base per-rank batch size.
Returns: DiffusionDataloaderBuild
Materialized stateful dataloader and its resumable bucket sampler.
Bases: BaseMultiresolutionDataset
Dataset for cached instruction-based image editing.
Each cache payload contains a target latent [channels, height, width],
an ordered list of context latents with the same axis order, prompt
embeddings [sequence, hidden], an attention mask [sequence], and
an optional explicitly named mapping of model-conditioning tensors.
Load and validate one cached image-edit sample.
Parameters:
Zero-based sample index.
Returns: dict[str, object]
Mapping containing a target latent tensor of shape [channels,
Validate and normalize provenance and tensor-shape metadata.
Parameters:
Serialized sample provenance and cache metadata.
Target shape [channels, height, width] and ordered context shapes [channels, context_height, context_width].
Sequence axis length of prompt embeddings.
Named tensors with arbitrary, explicitly metadata-declared shapes.
Cache file used to identify invalid fields in errors.
Returns: _ImageEditCacheMetadata
Validated metadata with spatial shapes, token lengths, and compound
Return target/context shape groups used by the bucket sampler.
Returns: dict[str, object]
Mapping containing the bucket count and sample count per compound
Construction-time configuration for :class:ImageEditDataset.
Directory containing a preprocessed image-edit cache.
Spatial quantization used for dynamic batch-size calculation.
Build the configured image-edit dataset.
Returns: ImageEditDataset
Dataset backed by the configured preprocessed cache.
Bases: typing.TypedDict
Bases: typing.TypedDict
Bases: typing.TypedDict
Bases: typing.TypedDict
Bases: typing.TypedDict
Collate samples with compatible target and ordered-context shapes.
Parameters:
Samples containing target tensors of shape [channels, height, width], ordered context tensors of shape [channels, context_height, context_width], prompt tensors of shape [sequence, hidden], prompt masks of shape [sequence], and optional named conditioning tensors.
Returns: _ImageEditBatch
Batch containing image_latents of shape [batch, channels, height,
Pad cached prompt encodings to a common sequence length.
Parameters:
Prompt tensors, each of shape [sequence, hidden].
Attention-mask tensors, each of shape [sequence].
Returns: torch.Tensor
Prompt embeddings of shape [batch, max_sequence, hidden] and attention
Read a tensor field from a cache payload.
Parameters:
Cache mapping whose tensor fields may have arbitrary shapes.
Name of the tensor field to read.
Returns: torch.Tensor
Cached tensor with arbitrary shape; the field owner validates its layout.
Stack explicitly named model-conditioning tensors.
Parameters:
Samples whose conditioning_tensors entries contain tensors
with metadata-declared arbitrary shapes. A given name must have the
same shape and dtype in every sample.
Returns: dict[str, torch.Tensor]
Mapping whose tensors have shape [batch, …], where trailing axes match
Validate a cached image latent.
Parameters:
Tensor of shape [channels, height, width].
Cache field name used in validation errors.
Returns: tuple[int, int, int]
Validated tensor shape in [channels, height, width] order.