+
    QV-j  ã                   óR   € ^ RI Ht ^RIHtHt ^RIHtHt ]! R]]4      tR R lt	R# )é    )ÚTypeVar)ÚDatasetÚ _split_by_node_map_style_dataset)ÚIterableDatasetÚ_split_by_node_iterable_datasetÚDatasetTypec                óH   € V ^8„  d   QhR\         R\        R\        R\         /# )é   ÚdatasetÚrankÚ
world_sizeÚreturn)r   Úint)Úformats   "Úe/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/datasets/distributed.pyÚ__annotate__r   
   s.   € ÷ !Zñ !Z¤;ð !Z´cð !ZÄsð !ZÌ{ñ !Zó    c                ób   € \        V \        4      '       d   \        WVR7      # \        WVR7      # )a…  
Split a dataset for the node at rank `rank` in a pool of nodes of size `world_size`.

For map-style datasets:

Each node is assigned a chunk of data, e.g. rank 0 is given the first chunk of the dataset.
To maximize data loading throughput, chunks are made of contiguous data on disk if possible.

For iterable datasets:

If the dataset has a number of shards that is a factor of `world_size` (i.e. if `dataset.num_shards % world_size == 0`),
then the shards are evenly assigned across the nodes, which is the most optimized.
Otherwise, each node keeps 1 example out of `world_size`, skipping the other examples.

> [!WARNING]
> If you shuffle your iterable dataset in a distributed setup, make sure to set a fixed `seed` in [`IterableDataset.shuffle`]
so the same shuffled list of shards is used on every node to know which shards the node should skip.

Args:
    dataset ([`Dataset`] or [`IterableDataset`]):
        The dataset to split by node.
    rank (`int`):
        Rank of the current node.
    world_size (`int`):
        Total number of nodes.

Returns:
    [`Dataset`] or [`IterableDataset`]: The dataset to be used on the node at rank `rank`.
)r   r   )Ú
isinstancer   r   r   )r   r   r   s   &&&r   Úsplit_dataset_by_noder   
   s+   € ô< �'œ7×#Ò#Ü/°ÈzÔZÐZä.¨wÈjÔYÐYr   N)
Útypingr   Úarrow_datasetr   r   Úiterable_datasetr   r   r   r   © r   r   Ú<module>r      s$   ðÝ ç Dß Nñ �m W¨oÓ>€÷!Zr   