

"""simple docstring"""




from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig


__UpperCAmelCase =				{
    'albert-base-v1': 'https://huggingface.co/albert-base-v1/resolve/main/config.json',
    'albert-large-v1': 'https://huggingface.co/albert-large-v1/resolve/main/config.json',
    'albert-xlarge-v1': 'https://huggingface.co/albert-xlarge-v1/resolve/main/config.json',
    'albert-xxlarge-v1': 'https://huggingface.co/albert-xxlarge-v1/resolve/main/config.json',
    'albert-base-v2': 'https://huggingface.co/albert-base-v2/resolve/main/config.json',
    'albert-large-v2': 'https://huggingface.co/albert-large-v2/resolve/main/config.json',
    'albert-xlarge-v2': 'https://huggingface.co/albert-xlarge-v2/resolve/main/config.json',
    'albert-xxlarge-v2': 'https://huggingface.co/albert-xxlarge-v2/resolve/main/config.json',
}







class      __lowercase			(    __lowerCamelCase					):
  snake_case_				       =       """albert"""

  def __init__(  self		:			Optional[int]					,A		:			Union[str, Any]=30_000					,A		:			Optional[Any]=128					,A		:			Dict=4_096					,A		:			Tuple=12					,A		:			int=1					,A		:			List[str]=64					,A		:			Union[str, Any]=16_384					,A		:			Union[str, Any]=1					,A		:			Optional[Any]="gelu_new"					,A		:			List[str]=0					,A		:			List[str]=0					,A		:			Tuple=512					,A		:			Optional[int]=2					,A		:			Optional[Any]=0.0_2					,A		:			Optional[Any]=1e-12					,A		:			Tuple=0.1					,A		:			int="absolute"					,A		:			Optional[Any]=0					,A		:			Optional[Any]=2					,A		:			List[str]=3					,**A		:			List[str]					,):






   '''simple docstring'''
   super().__init__(pad_token_id=A					,bos_token_id=A					,eos_token_id=A					,**A    )

   UpperCAmelCase__					:  List[str]					   =					vocab_size
   UpperCAmelCase__					:  str					   =					embedding_size
   UpperCAmelCase__					:  List[Any]					   =					hidden_size
   UpperCAmelCase__					:  Tuple					   =					num_hidden_layers
   UpperCAmelCase__					:  List[str]					   =					num_hidden_groups
   UpperCAmelCase__					:  List[Any]					   =					num_attention_heads
   UpperCAmelCase__					:  Tuple					   =					inner_group_num
   UpperCAmelCase__					:  List[Any]					   =					hidden_act
   UpperCAmelCase__					:  int					   =					intermediate_size
   UpperCAmelCase__					:  Dict					   =					hidden_dropout_prob
   UpperCAmelCase__					:  Any					   =					attention_probs_dropout_prob
   UpperCAmelCase__					:  Any					   =					max_position_embeddings
   UpperCAmelCase__					:  Tuple					   =					type_vocab_size
   UpperCAmelCase__					:  Optional[Any]					   =					initializer_range
   UpperCAmelCase__					:  List[Any]					   =					layer_norm_eps
   UpperCAmelCase__					:  Optional[int]					   =					classifier_dropout_prob
   UpperCAmelCase__					:  Any					   =					position_embedding_type







class      __lowercase			(    __lowerCamelCase					):

  @property
  def    __lowercase       (  self		:			Tuple    ):






   '''simple docstring'''
   if self.task == "multiple-choice":
    UpperCAmelCase__					:  List[str]					   =					{0: """batch""", 1: """choice""", 2: """sequence"""}
   else:
    UpperCAmelCase__					:  List[str]					   =					{0: """batch""", 1: """sequence"""}
   return OrderedDict(
       [
           ("""input_ids""", dynamic_axis),
           ("""attention_mask""", dynamic_axis),
           ("""token_type_ids""", dynamic_axis),
       ]    )








"""simple docstring"""




from typing import List, Optional, TypeVar

from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets
from .dataset_dict import DatasetDict, IterableDatasetDict
from .info import DatasetInfo
from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _interleave_iterable_datasets
from .splits import NamedSplit
from .utils import logging
from .utils.py_utils import Literal


__UpperCAmelCase =				logging.get_logger(__name__)


__UpperCAmelCase =				TypeVar('DatasetType', Dataset, IterableDataset)
def   lowerCAmelCase						(					__UpperCamelCase							,    __UpperCamelCase = None							,    __UpperCamelCase = None							,    __UpperCamelCase = None							,    __UpperCamelCase = None							,    __UpperCamelCase = "first_exhausted"							,    ):
 '''simple docstring'''





 from .arrow_dataset import Dataset
 from .iterable_dataset import IterableDataset

 if not datasets:
  raise ValueError("""Unable to interleave an empty list of datasets."""      )
 for i, dataset in enumerate(__UpperCamelCase      ):
  if not isinstance(__UpperCamelCase							,    (Dataset, IterableDataset)      ):
   if isinstance(__UpperCamelCase							,    (DatasetDict, IterableDatasetDict)      ):
    if not dataset:
     raise ValueError(
         F"Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} "
         """is an empty dataset dictionary."""      )
    raise ValueError(
        F"Dataset at position {i} has at least one split: {list(__UpperCamelCase      )}\n"
        F"Please pick one to interleave with the other datasets, for example: dataset['{next(iter(__UpperCamelCase      )      )}']"      )
   raise ValueError(
       F"Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} is a {type(__UpperCamelCase      ).__name__}."      )
  if i == 0:
   UpperCAmelCase__   ,      UpperCAmelCase__					:  List[str]					   =					(
       (Dataset, IterableDataset) if isinstance(__UpperCamelCase							,    __UpperCamelCase      ) else (IterableDataset, Dataset)
   )
  elif not isinstance(__UpperCamelCase							,    __UpperCamelCase      ):
   raise ValueError(
       F"Unable to interleave a {dataset_type.__name__} (at position 0) with a {other_type.__name__} (at position {i}). Expected a list of Dataset objects or a list of IterableDataset objects."      )
 if stopping_strategy not in ["first_exhausted", "all_exhausted"]:
  raise ValueError(F"{stopping_strategy} is not supported. Please enter a valid stopping_strategy."      )
 if dataset_type is Dataset:
  return _interleave_map_style_datasets(
      __UpperCamelCase							,    __UpperCamelCase							,    __UpperCamelCase							,    info=__UpperCamelCase							,    split=__UpperCamelCase							,    stopping_strategy=__UpperCamelCase      )
 else:
  return _interleave_iterable_datasets(
      __UpperCamelCase							,    __UpperCamelCase							,    __UpperCamelCase							,    info=__UpperCamelCase							,    split=__UpperCamelCase							,    stopping_strategy=__UpperCamelCase      )




def   lowerCAmelCase						(					__UpperCamelCase							,    __UpperCamelCase = None							,    __UpperCamelCase = None							,    __UpperCamelCase = 0							,    ):
 '''simple docstring'''





 if not dsets:
  raise ValueError("""Unable to concatenate an empty list of datasets."""      )
 for i, dataset in enumerate(__UpperCamelCase      ):
  if not isinstance(__UpperCamelCase							,    (Dataset, IterableDataset)      ):
   if isinstance(__UpperCamelCase							,    (DatasetDict, IterableDatasetDict)      ):
    if not dataset:
     raise ValueError(
         F"Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} "
         """is an empty dataset dictionary."""      )
    raise ValueError(
        F"Dataset at position {i} has at least one split: {list(__UpperCamelCase      )}\n"
        F"Please pick one to interleave with the other datasets, for example: dataset['{next(iter(__UpperCamelCase      )      )}']"      )
   raise ValueError(
       F"Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} is a {type(__UpperCamelCase      ).__name__}."      )
  if i == 0:
   UpperCAmelCase__   ,      UpperCAmelCase__					:  Optional[int]					   =					(
       (Dataset, IterableDataset) if isinstance(__UpperCamelCase							,    __UpperCamelCase      ) else (IterableDataset, Dataset)
   )
  elif not isinstance(__UpperCamelCase							,    __UpperCamelCase      ):
   raise ValueError(
       F"Unable to interleave a {dataset_type.__name__} (at position 0) with a {other_type.__name__} (at position {i}). Expected a list of Dataset objects or a list of IterableDataset objects."      )
 if dataset_type is Dataset:
  return _concatenate_map_style_datasets(__UpperCamelCase							,    info=__UpperCamelCase							,    split=__UpperCamelCase							,    axis=__UpperCamelCase      )
 else:
  return _concatenate_iterable_datasets(__UpperCamelCase							,    info=__UpperCamelCase							,    split=__UpperCamelCase							,    axis=__UpperCamelCase      )





