# tinker_cookbook.supervised.StreamingSupervisedDatasetFromHFDataset

## _class_ [**tinker_cookbook.supervised.StreamingSupervisedDatasetFromHFDataset**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/supervised/data.py#L137)( _[SupervisedDataset](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/supervised/superviseddataset/)_)

A supervised dataset that streams from HuggingFace, reducing memory usage.

Only supports forward iteration; seeking backward raises an error.

### [**get_batch**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/supervised/data.py#L175)( _index_)

Return a batch of Datum objects at the given index.

Only forward iteration is supported. Requesting a batch at or before the most recently returned index raises [`DataValidationError`](https://tinker-docs.thinking-machines.ai/cookbook/api-reference/exceptions/datavalidationerror/).

**Parameters:**

- [**index**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/supervised/data.py#L175) ( _int_) – Zero-based batch index (must be strictly greater than the previous call's index).

**Returns:** _list[tinker. [Datum](https://tinker-docs.thinking-machines.ai/tinker/api-reference/types/datum/)_ – Training datums for this batch.

**Raises:**

- DataValidationError: If `index` would require backward seeking.

### [**set_epoch**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/supervised/data.py#L214)( _seed_)

Reset the stream for a new epoch.

**Parameters:**

- [**seed**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/supervised/data.py#L214) ( _int_) – Epoch seed forwarded to the underlying iterable dataset. Default `0`.
