code: def _replay_sampling(
      num_samples_yielded: int, batch_size: int, num_workers: int
  ) -> Dict[int, int]:
      """This function replays the sampling from the dataloader."""
      divisible_num_batches_yielded = num_samples_yielded // (
          num_workers * batch_size
      )
  
      indexes = {}
      for worker_idx in range(num_workers):
          indexes[worker_idx] = (
              divisible_num_batches_yielded * batch_size
          )
  
      num_samples_yielded = num_samples_yielded - (
          num_workers * divisible_num_batches_yielded * batch_size
      )
  
      # take care of the reminder
      worker_idx = 0  # reset the worker_idx
      while True:
          if num_samples_yielded >= batch_size:
              indexes[worker_idx] += batch_size
              worker_idx = (worker_idx + 1) % num_workers
              num_samples_yielded -= batch_size
          else:
              indexes[worker_idx] += num_samples_yielded
              break
      return indexes
  
imports: import hashlib
  import os
  from dataclasses import dataclass
  from time import time
  from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  from torch.utils.data import IterableDataset, get_worker_info
  from lightning.data.streaming import Cache
  from lightning.data.streaming.constants import _DEFAULT_CACHE_DIR, _INDEX_FILENAME, _LIGHTNING_CLOUD_LATEST
  from lightning.data.streaming.item_loader import BaseItemLoader
  from lightning.data.streaming.sampler import ChunkedIndex
  from lightning.data.streaming.serializers import Serializer
  from lightning.data.streaming.shuffle import FullShuffle, NoShuffle, Shuffle
  from lightning.data.utilities.env import Environment, _DistributedEnv, _WorkerEnv
label_desc: Use image node_id 6 for calling a global function with example usage: _replay_sampling(num_samples_yielded, batch_size, num_workers) and returns: indexes