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

# aistore.pytorch.batch_iter_dataset

Iterable Dataset using Batch API for AIS

Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.

## Module Contents

### Classes

| Name                                                                             | Description                                                                           |
| -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| [`AISBatchIterDataset`](#aistore-pytorch-batch_iter_dataset-AISBatchIterDataset) | Custom AIStore PyTorch dataset that uses the AIS batch API for efficient data loading |

### API

```python
class aistore.pytorch.batch_iter_dataset.AISBatchIterDataset(
    ais_source_list,
    client: aistore.sdk.Client,
    prefix_map: typing.Dict[aistore.sdk.AISSource, typing.Union[str, typing.List[str]]] = {},
    show_progress: bool = False,
    max_batch_size: int = 32,
    output_format: str = '.tar',
    streaming: bool = True
)
```

**Bases:** [AISBaseIterDataset](/python/aistore/pytorch/base_iter_dataset#aistore-pytorch-base_iter_dataset-AISBaseIterDataset)

Custom AIStore PyTorch dataset that uses the AIS batch API for efficient data loading
with multi-worker support and memory-efficient iteration.

**Parameters:**

Single or list of AISSource objects to load data

AIStore client instance

Maximum number of objects to fetch in each batch request. Defaults to 32

Format for batch response. Defaults to ".tar"

Enable streaming mode. Defaults to True

Map of AISSource objects to prefixes

Show progress indicator. Defaults to False

```python
aistore.pytorch.batch_iter_dataset.AISBatchIterDataset.__iter__() -> typing.Iterator[typing.Tuple[str, bytes]]
```

Memory-efficient iterator with multi-worker support using batch API.

```python
aistore.pytorch.batch_iter_dataset.AISBatchIterDataset._process_batch(
    batch_objects: typing.List
) -> typing.Iterator[typing.Tuple[str, bytes]]
```

Process a batch of objects using the batch API.

**Parameters:**

List of objects to process in this batch