> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/automodel/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/automodel/_mcp/server.

# nemo_automodel.components.datasets.diffusion.text_to_image_dataset

## Module Contents

### Classes

| Name                                                                                                                       | Description                                                      |
| -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| [`TextToImageDataset`](#nemo_automodel-components-datasets-diffusion-text_to_image_dataset-TextToImageDataset)             | Text-to-Image dataset with hierarchical bucket organization.     |
| [`TextToImageDatasetConfig`](#nemo_automodel-components-datasets-diffusion-text_to_image_dataset-TextToImageDatasetConfig) | Construction-time configuration for :class:`TextToImageDataset`. |

### API

```python
class nemo_automodel.components.datasets.diffusion.text_to_image_dataset.TextToImageDataset(
    cache_dir: str,
    train_text_encoder: bool = False
)
```

**Bases:** [BaseMultiresolutionDataset](/nemo-automodel/nemo_automodel/components/datasets/diffusion/base_dataset#nemo_automodel-components-datasets-diffusion-base_dataset-BaseMultiresolutionDataset)

Text-to-Image dataset with hierarchical bucket organization.

```python
nemo_automodel.components.datasets.diffusion.text_to_image_dataset.TextToImageDataset.__getitem__(
    idx: int
) -> typing.Dict[str, torch.Tensor]
```

Load a single sample.

```python
class nemo_automodel.components.datasets.diffusion.text_to_image_dataset.TextToImageDatasetConfig(
    cache_dir: str,
    train_text_encoder: bool = False
)
```

Dataclass

Construction-time configuration for :class:`TextToImageDataset`.

Directory containing preprocessed cache.

If True, returns tokens instead of embeddings.

```python
nemo_automodel.components.datasets.diffusion.text_to_image_dataset.TextToImageDatasetConfig.build() -> 'TextToImageDataset'
```

Build a :class:`TextToImageDataset` from this :class:`TextToImageDatasetConfig`.