





from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


__lowerCamelCase :  Optional[Any]										=  logging.get_logger(__name__)

__lowerCamelCase :  Tuple										=  {
    """xlm-mlm-en-2048""": """https://huggingface.co/xlm-mlm-en-2048/resolve/main/config.json""",
    """xlm-mlm-ende-1024""": """https://huggingface.co/xlm-mlm-ende-1024/resolve/main/config.json""",
    """xlm-mlm-enfr-1024""": """https://huggingface.co/xlm-mlm-enfr-1024/resolve/main/config.json""",
    """xlm-mlm-enro-1024""": """https://huggingface.co/xlm-mlm-enro-1024/resolve/main/config.json""",
    """xlm-mlm-tlm-xnli15-1024""": """https://huggingface.co/xlm-mlm-tlm-xnli15-1024/resolve/main/config.json""",
    """xlm-mlm-xnli15-1024""": """https://huggingface.co/xlm-mlm-xnli15-1024/resolve/main/config.json""",
    """xlm-clm-enfr-1024""": """https://huggingface.co/xlm-clm-enfr-1024/resolve/main/config.json""",
    """xlm-clm-ende-1024""": """https://huggingface.co/xlm-clm-ende-1024/resolve/main/config.json""",
    """xlm-mlm-17-1280""": """https://huggingface.co/xlm-mlm-17-1280/resolve/main/config.json""",
    """xlm-mlm-100-1280""": """https://huggingface.co/xlm-mlm-100-1280/resolve/main/config.json""",
}



class       A__     ( __snake_case    ):
      _UpperCAmelCase			:Dict							=     'xlm'
      _UpperCAmelCase			:Dict							=     {
          'hidden_size': 'emb_dim',
          'num_attention_heads': 'n_heads',
          'num_hidden_layers': 'n_layers',
          'n_words': 'vocab_size',  # For backward compatibility
      }





      def __init__(				self ,							A_=3_0145 ,							A_=2048 ,							A_=12 ,							A_=16 ,							A_=0.1 ,							A_=0.1 ,							A_=True ,							A_=False ,							A_=False ,							A_=False ,							A_=1 ,							A_=True ,							A_=512 ,							A_=2048**-0.5 ,							A_=1e-12 ,							A_=0.02 ,							A_=0 ,							A_=1 ,							A_=2 ,							A_=3 ,							A_=5 ,							A_=True ,							A_="first" ,							A_=True ,							A_=None ,							A_=True ,							A_=0.1 ,							A_=5 ,							A_=5 ,							A_=0 ,							A_=0 ,							A_=2 ,							A_=0 ,							**A_ ,							):
       '''simple docstring'''




       UpperCamelCase			:      Any			=     vocab_size
       UpperCamelCase			:      Union[str, Any]			=     emb_dim
       UpperCamelCase			:      Union[str, Any]			=     n_layers
       UpperCamelCase			:      Union[str, Any]			=     n_heads
       UpperCamelCase			:      List[Any]			=     dropout
       UpperCamelCase			:      Any			=     attention_dropout
       UpperCamelCase			:      str			=     gelu_activation
       UpperCamelCase			:      Optional[Any]			=     sinusoidal_embeddings
       UpperCamelCase			:      int			=     causal
       UpperCamelCase			:      Dict			=     asm
       UpperCamelCase			:      Optional[Any]			=     n_langs
       UpperCamelCase			:      Union[str, Any]			=     use_lang_emb
       UpperCamelCase			:      Union[str, Any]			=     layer_norm_eps
       UpperCamelCase			:      Any			=     bos_index
       UpperCamelCase			:      Any			=     eos_index
       UpperCamelCase			:      List[str]			=     pad_index
       UpperCamelCase			:      Optional[Any]			=     unk_index
       UpperCamelCase			:      List[str]			=     mask_index
       UpperCamelCase			:      Optional[int]			=     is_encoder
       UpperCamelCase			:      Dict			=     max_position_embeddings
       UpperCamelCase			:      Tuple			=     embed_init_std
       UpperCamelCase			:      Dict			=     init_std
       UpperCamelCase			:      List[Any]			=     summary_type
       UpperCamelCase			:      Dict			=     summary_use_proj
       UpperCamelCase			:      List[Any]			=     summary_activation
       UpperCamelCase			:      Tuple			=     summary_proj_to_labels
       UpperCamelCase			:      List[Any]			=     summary_first_dropout
       UpperCamelCase			:      Tuple			=     start_n_top
       UpperCamelCase			:      Tuple			=     end_n_top
       UpperCamelCase			:      Dict			=     mask_token_id
       UpperCamelCase			:      Tuple			=     lang_id

       if "n_words" in kwargs:
        UpperCamelCase			:      Any			=     kwargs["n_words"]

       super().__init__(pad_token_id=A_ ,							bos_token_id=A_ ,							**A_     )



class       A__     ( __snake_case    ):





      @property
      def  __UpperCamelCase(				self     ):
       '''simple docstring'''




       if self.task == "multiple-choice":
        UpperCamelCase			:      int			=     {0: "batch", 1: "choice", 2: "sequence"}
       else:
        UpperCamelCase			:      Any			=     {0: "batch", 1: "sequence"}
       return OrderedDict(
           [
               ("input_ids", dynamic_axis),
               ("attention_mask", dynamic_axis),
               ("token_type_ids", dynamic_axis),
           ]     )







from typing import Callable, Optional

from .. import Features
from ..packaged_modules.generator.generator import Generator
from .abc import AbstractDatasetInputStream



class       A__     ( __snake_case    ):





      def __init__(				self ,							A_ ,							A_ = None ,							A_ = None ,							A_ = False ,							A_ = False ,							A_ = None ,							A_ = None ,							**A_ ,							):
       '''simple docstring'''




       super().__init__(
           features=A_ ,							cache_dir=A_ ,							keep_in_memory=A_ ,							streaming=A_ ,							num_proc=A_ ,							**A_ ,							)
       UpperCamelCase			:      Optional[int] 			=     Generator(
           cache_dir=A_ ,							features=A_ ,							generator=A_ ,							gen_kwargs=A_ ,							**A_ ,							)





      def  __UpperCamelCase(				self     ):
       '''simple docstring'''




       if self.streaming:
        UpperCamelCase			:      Optional[Any] 			=     self.builder.as_streaming_dataset(split="train"     )
       # Build regular (map-style) dataset
       else:
        UpperCamelCase			:      Union[str, Any] 			=     None
        UpperCamelCase			:      Union[str, Any] 			=     None
        UpperCamelCase			:      List[Any] 			=     None
        UpperCamelCase			:      List[str] 			=     None

        self.builder.download_and_prepare(
            download_config=A_ ,							download_mode=A_ ,							verification_mode=A_ ,							base_path=A_ ,							num_proc=self.num_proc ,							)
        UpperCamelCase			:      int 			=     self.builder.as_dataset(
            split="train" ,							verification_mode=A_ ,							in_memory=self.keep_in_memory     )
       return dataset
