> 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.multimodal.loader

Typed construction for the packed BAGEL multimodal dataloader.

## Module Contents

### Classes

| Name                                                                                                   | Description                                                            |
| ------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
| [`BagelDataloaderBuild`](#nemo_automodel-components-datasets-multimodal-loader-BagelDataloaderBuild)   | Materialized BAGEL dataloader and its packed dataset.                  |
| [`BagelDataloaderConfig`](#nemo_automodel-components-datasets-multimodal-loader-BagelDataloaderConfig) | Construction-time configuration for the complete BAGEL input pipeline. |

### Data

[`__all__`](#nemo_automodel-components-datasets-multimodal-loader-__all__)

### API

```python
class nemo_automodel.components.datasets.multimodal.loader.BagelDataloaderBuild(
    dataloader: torchdata.stateful_dataloader.StatefulDataLoader,
    dataset: nemo_automodel.components.datasets.multimodal.packing.PackedDataset
)
```

Dataclass

Materialized BAGEL dataloader and its packed dataset.

```python
class nemo_automodel.components.datasets.multimodal.loader.BagelDataloaderConfig(
    dataset_config: nemo_automodel.components.datasets.multimodal.datasets.BagelDatasetConfig,
    num_workers: int = 1,
    pin_memory: bool = True,
    prefetch_factor: int = 2
)
```

Dataclass

Construction-time configuration for the complete BAGEL input pipeline.

```python
nemo_automodel.components.datasets.multimodal.loader.BagelDataloaderConfig.build(
    tokenizer: 'PreTrainedTokenizerBase',
    special_tokens: collections.abc.Mapping[str, object],
    rank: int,
    world_size: int,
    batch_size: int,
    global_seed: int
) -> nemo_automodel.components.datasets.multimodal.loader.BagelDataloaderBuild
```

Build the packed BAGEL dataset and its stateful dataloader.

**Parameters:**

Runtime tokenizer used by the packed dataset.

Runtime BAGEL special-token mapping.

Global distributed rank used for source-data sharding and worker seeding.

Global distributed world size.

Runtime local batch size; BAGEL packed samples require one row per step.

Global training seed used to initialize dataloader worker RNG state.

**Returns:** `BagelDataloaderBuild`

Named result containing the dataloader and its packed dataset.

```python
nemo_automodel.components.datasets.multimodal.loader.__all__ = ['BagelDataloaderBuild', 'BagelDataloaderConfig']
```