class_docstr: Multi-Source Infinite Sampler.
  
  According to the sampling ratio, sample data from different
  datasets to form batches.
  
  Args:
      dataset (Sized): The dataset.
      batch_size (int): Size of mini-batch.
      source_ratio (list[int | float]): The sampling ratio of different
          source datasets in a mini-batch.
      shuffle (bool): Whether shuffle the dataset or not. Defaults to True.
      seed (int, optional): Random seed. If None, set a random seed.
          Defaults to None.
  
  Examples:
      >>> dataset_type = 'ConcatDataset'
      >>> sub_dataset_type = 'CocoDataset'
      >>> data_root = 'data/coco/'
      >>> sup_ann = '../coco_semi_annos/instances_train2017.1@10.json'
      >>> unsup_ann = '../coco_semi_annos/' \
      >>>             'instances_train2017.1@10-unlabeled.json'
      >>> dataset = dict(type=dataset_type,
      >>>     datasets=[
      >>>         dict(
      >>>             type=sub_dataset_type,
      >>>             data_root=data_root,
      >>>             ann_file=sup_ann,
      >>>             data_prefix=dict(img='train2017/'),
      >>>             filter_cfg=dict(filter_empty_gt=True, min_size=32),
      >>>             pipeline=sup_pipeline),
      >>>         dict(
      >>>             type=sub_dataset_type,
      >>>             data_root=data_root,
      >>>             ann_file=unsup_ann,
      >>>             data_prefix=dict(img='train2017/'),
      >>>             filter_cfg=dict(filter_empty_gt=True, min_size=32),
      >>>             pipeline=unsup_pipeline),
      >>>         ])
      >>>     train_dataloader = dict(
      >>>         batch_size=5,
      >>>         num_workers=5,
      >>>         persistent_workers=True,
      >>>         sampler=dict(type='MultiSourceSampler',
      >>>             batch_size=5, source_ratio=[1, 4]),
      >>>         batch_sampler=None,
      >>>         dataset=dataset)
class_docstr_tok: ["Multi-Source","Infinite","Sampler",".","According","to","the","sampling","ratio",",","sample","data","from","different","datasets","to","form","batches",".","Args",":","dataset","(","Sized",")",":","The","dataset",".","batch_size","(","int",")",":","Size","of","mini-batch",".","source_ratio","(","list","[","int","|","float","]",")",":","The","sampling","ratio","of","different","source","datasets","in","a","mini-batch",".","shuffle","(","bool",")",":","Whether","shuffle","the","dataset","or","not",".","Defaults","to","True",".","seed","(","int",",","optional",")",":","Random","seed",".","If","None",",","set","a","random","seed",".","Defaults","to","None",".","Examples",":",">",">",">","dataset_type","=","'ConcatDataset'",">",">",">","sub_dataset_type","=","'CocoDataset'",">",">",">","data_root","=","'data\/coco\/'",">",">",">","sup_ann","=","'","..","\/coco_semi_annos\/instances_train2017.1","@","10.json'",">",">",">","unsup_ann","=","'","..","\/coco_semi_annos\/","'","\\",">",">",">","'instances_train2017.1","@","10-unlabeled.json'",">",">",">","dataset","=","dict","(","type=dataset_type",",",">",">",">","datasets=","[",">",">",">","dict","(",">",">",">","type=sub_dataset_type",",",">",">",">","data_root=data_root",",",">",">",">","ann_file=sup_ann",",",">",">",">","data_prefix=dict","(","img='train2017\/","'",")",",",">",">",">","filter_cfg=dict","(","filter_empty_gt=True",",","min_size=32",")",",",">",">",">","pipeline=sup_pipeline",")",",",">",">",">","dict","(",">",">",">","type=sub_dataset_type",",",">",">",">","data_root=data_root",",",">",">",">","ann_file=unsup_ann",",",">",">",">","data_prefix=dict","(","img='train2017\/","'",")",",",">",">",">","filter_cfg=dict","(","filter_empty_gt=True",",","min_size=32",")",",",">",">",">","pipeline=unsup_pipeline",")",",",">",">",">","]",")",">",">",">","train_dataloader","=","dict","(",">",">",">","batch_size=5",",",">",">",">","num_workers=5",",",">",">",">","persistent_workers=True",",",">",">",">","sampler=dict","(","type='MultiSourceSampler","'",",",">",">",">","batch_size=5",",","source_ratio=","[","1",",","4","]",")",",",">",">",">","batch_sampler=None",",",">",">",">","dataset=dataset",")"]
docstr: Not supported in `epoch-based runner.
docstr_tok: ["Not","supported","in","`","epoch-based","runner","."]
code: def set_epoch(self, epoch: int) -> None:
      """Not supported in `epoch-based runner."""
      pass
  
imports: import itertools
  from typing import Iterator, List, Optional, Sized, Union
  import numpy
  import torch
  from mmengine.dataset import BaseDataset
  from mmengine.dist import get_dist_info, sync_random_seed
  from torch.utils.data import Sampler
  from mmdet.registry import DATA_SAMPLERS
label_desc: Use image node_id 6 for calling the MultiSourceSampler obj's underlying member method code with example usage: obj.set_epoch(epoch) without return types