class_docstr: This sampler takes in a dictionary of iterators and returns batches alternating
  between keys and probabilities specified by `unnormalized_iterator_probs` and
  'second_unnormalized_iterator_probs', This is used for example in XLM
  pre-training where we alternate between MLM and TLM batches.
class_docstr_tok: ["This","sampler","takes","in","a","dictionary","of","iterators","and","returns","batches","alternating","between","keys","and","probabilities","specified","by","`","unnormalized_iterator_probs","`","and","'second_unnormalized_iterator_probs","'",",","This","is","used","for","example","in","XLM","pre-training","where","we","alternate","between","MLM","and","TLM","batches","."]
code: def __init__(
      self,
      unnormalized_iterator_probs: Dict[str, float],
      second_unnormalized_iterator_probs: Dict[str, float],
  ) -> None:
      super().__init__(unnormalized_iterator_probs)
  
      (
          self.second_iterator_names,
          self.second_iterator_probs,
      ) = extract_iterator_properties(
          second_unnormalized_iterator_probs
      )
      self.is_secondary_turn = False
  
imports: from collections.abc import Iterator
  from typing import Dict, Optional
  import numpy
  from pytext.config.component import Component, ComponentType
label_desc: Use image node_id 2 to create a new AlternatingRandomizedBatchSampler object from inherited base classes: RandomizedBatchSampler with example: obj = AlternatingRandomizedBatchSampler(unnormalized_iterator_probs, second_unnormalized_iterator_probs)