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 from_config(cls, config: Config):
      assert (
          len(config.unnormalized_iterator_probs) > 0
          and len(config.second_unnormalized_iterator_probs) > 0
      )
      return cls(
          unnormalized_iterator_probs=config.unnormalized_iterator_probs,
          second_unnormalized_iterator_probs=(
              config.second_unnormalized_iterator_probs
          ),
      )
  
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 1 for calling the AlternatingRandomizedBatchSampler obj's underlying member method code with example usage: obj.from_config(cls, config) and returns: cls