





'''simple docstring'''



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


__magic_name__   :						Union[str, Any]    =			{
    """configuration_canine""": ["""CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CanineConfig"""],
    """tokenization_canine""": ["""CanineTokenizer"""],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __magic_name__   :						Optional[Any]    =			[
     """CANINE_PRETRAINED_MODEL_ARCHIVE_LIST""",
     """CanineForMultipleChoice""",
     """CanineForQuestionAnswering""",
     """CanineForSequenceClassification""",
     """CanineForTokenClassification""",
     """CanineLayer""",
     """CanineModel""",
     """CaninePreTrainedModel""",
     """load_tf_weights_in_canine""",
 ]


if TYPE_CHECKING:
 from .configuration_canine import CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP, CanineConfig
 from .tokenization_canine import CanineTokenizer

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_canine import (
      CANINE_PRETRAINED_MODEL_ARCHIVE_LIST,
      CanineForMultipleChoice,
      CanineForQuestionAnswering,
      CanineForSequenceClassification,
      CanineForTokenClassification,
      CanineLayer,
      CanineModel,
      CaninePreTrainedModel,
      load_tf_weights_in_canine,
  )


else:
 import sys

 __magic_name__   :						List[str]    =			_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)









'''simple docstring'''



from collections import OrderedDict
from typing import Mapping

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


__magic_name__   :						int    =			logging.get_logger(__name__)

__magic_name__   :						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       __SCREAMING_SNAKE_CASE	(						__UpperCamelCase			):



     '''simple docstring'''






     UpperCAmelCase__       :						Union[str, Any]      =   '''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						,   lowerCamelCase=30_145						,   lowerCamelCase=2_048						,   lowerCamelCase=12						,   lowerCamelCase=16						,   lowerCamelCase=0.1						,   lowerCamelCase=0.1						,   lowerCamelCase=True						,   lowerCamelCase=False						,   lowerCamelCase=False						,   lowerCamelCase=False						,   lowerCamelCase=1						,   lowerCamelCase=True						,   lowerCamelCase=512						,   lowerCamelCase=2_048**-0.5						,   lowerCamelCase=1e-12						,   lowerCamelCase=0.02						,   lowerCamelCase=0						,   lowerCamelCase=1						,   lowerCamelCase=2						,   lowerCamelCase=3						,   lowerCamelCase=5						,   lowerCamelCase=True						,   lowerCamelCase="first"						,   lowerCamelCase=True						,   lowerCamelCase=None						,   lowerCamelCase=True						,   lowerCamelCase=0.1						,   lowerCamelCase=5						,   lowerCamelCase=5						,   lowerCamelCase=0						,   lowerCamelCase=0						,   lowerCamelCase=2						,   lowerCamelCase=0						,   **lowerCamelCase						,   ):
       _snake_case     		=				vocab_size
       _snake_case     		=				emb_dim
       _snake_case     		=				n_layers
       _snake_case     		=				n_heads
       _snake_case     		=				dropout
       _snake_case     		=				attention_dropout
       _snake_case     		=				gelu_activation
       _snake_case     		=				sinusoidal_embeddings
       _snake_case     		=				causal
       _snake_case     		=				asm
       _snake_case     		=				n_langs
       _snake_case     		=				use_lang_emb
       _snake_case     		=				layer_norm_eps
       _snake_case     		=				bos_index
       _snake_case     		=				eos_index
       _snake_case     		=				pad_index
       _snake_case     		=				unk_index
       _snake_case     		=				mask_index
       _snake_case     		=				is_encoder
       _snake_case     		=				max_position_embeddings
       _snake_case     		=				embed_init_std
       _snake_case     		=				init_std
       _snake_case     		=				summary_type
       _snake_case     		=				summary_use_proj
       _snake_case     		=				summary_activation
       _snake_case     		=				summary_proj_to_labels
       _snake_case     		=				summary_first_dropout
       _snake_case     		=				start_n_top
       _snake_case     		=				end_n_top
       _snake_case     		=				mask_token_id
       _snake_case     		=				lang_id

       if "n_words" in kwargs:
         _snake_case     		=				kwargs["n_words"]

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







class       __SCREAMING_SNAKE_CASE	(						__UpperCamelCase			):



     '''simple docstring'''






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


