





from collections import OrderedDict
from typing import Mapping

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


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

_snake_case    :       str		       =    {
    '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 							_UpperCAmelCase       (       _UpperCamelCase       ):

  """simple docstring"""


  a_              =					"""xlm"""
  a_              =					{
      """hidden_size""": """emb_dim""",
      """num_attention_heads""": """n_heads""",
      """num_hidden_layers""": """n_layers""",
      """n_words""": """vocab_size""",  # For backward compatibility
  }






  def __init__(							self					:						Tuple   ,    lowerCAmelCase_					:						Optional[int]=3_0_1_4_5   ,    lowerCAmelCase_					:						Any=2_0_4_8   ,    lowerCAmelCase_					:						Optional[Any]=1_2   ,    lowerCAmelCase_					:						List[str]=1_6   ,    lowerCAmelCase_					:						List[str]=0.1   ,    lowerCAmelCase_					:						int=0.1   ,    lowerCAmelCase_					:						List[Any]=True   ,    lowerCAmelCase_					:						Union[str, Any]=False   ,    lowerCAmelCase_					:						List[str]=False   ,    lowerCAmelCase_					:						Optional[int]=False   ,    lowerCAmelCase_					:						Optional[int]=1   ,    lowerCAmelCase_					:						str=True   ,    lowerCAmelCase_					:						List[Any]=5_1_2   ,    lowerCAmelCase_					:						List[str]=2_0_4_8**-0.5   ,    lowerCAmelCase_					:						List[str]=1e-12   ,    lowerCAmelCase_					:						Tuple=0.02   ,    lowerCAmelCase_					:						Dict=0   ,    lowerCAmelCase_					:						List[Any]=1   ,    lowerCAmelCase_					:						Any=2   ,    lowerCAmelCase_					:						List[str]=3   ,    lowerCAmelCase_					:						Tuple=5   ,    lowerCAmelCase_					:						Any=True   ,    lowerCAmelCase_					:						Optional[Any]="first"   ,    lowerCAmelCase_					:						Optional[Any]=True   ,    lowerCAmelCase_					:						str=None   ,    lowerCAmelCase_					:						str=True   ,    lowerCAmelCase_					:						Union[str, Any]=0.1   ,    lowerCAmelCase_					:						Optional[Any]=5   ,    lowerCAmelCase_					:						Dict=5   ,    lowerCAmelCase_					:						str=0   ,    lowerCAmelCase_					:						Dict=0   ,    lowerCAmelCase_					:						Optional[Any]=2   ,    lowerCAmelCase_					:						Tuple=0   ,    **lowerCAmelCase_					:						Optional[int]   ,    )				->		int:
     __lowerCAmelCase				      =      vocab_size
     __lowerCAmelCase				      =      emb_dim
     __lowerCAmelCase				      =      n_layers
     __lowerCAmelCase				      =      n_heads
     __lowerCAmelCase				      =      dropout
     __lowerCAmelCase				      =      attention_dropout
     __lowerCAmelCase				      =      gelu_activation
     __lowerCAmelCase				      =      sinusoidal_embeddings
     __lowerCAmelCase				      =      causal
     __lowerCAmelCase				      =      asm
     __lowerCAmelCase				      =      n_langs
     __lowerCAmelCase				      =      use_lang_emb
     __lowerCAmelCase				      =      layer_norm_eps
     __lowerCAmelCase				      =      bos_index
     __lowerCAmelCase				      =      eos_index
     __lowerCAmelCase				      =      pad_index
     __lowerCAmelCase				      =      unk_index
     __lowerCAmelCase				      =      mask_index
     __lowerCAmelCase				      =      is_encoder
     __lowerCAmelCase				      =      max_position_embeddings
     __lowerCAmelCase				      =      embed_init_std
     __lowerCAmelCase				      =      init_std
     __lowerCAmelCase				      =      summary_type
     __lowerCAmelCase				      =      summary_use_proj
     __lowerCAmelCase				      =      summary_activation
     __lowerCAmelCase				      =      summary_proj_to_labels
     __lowerCAmelCase				      =      summary_first_dropout
     __lowerCAmelCase				      =      start_n_top
     __lowerCAmelCase				      =      end_n_top
     __lowerCAmelCase				      =      mask_token_id
     __lowerCAmelCase				      =      lang_id

     if "n_words" in kwargs:
        __lowerCAmelCase				      =      kwargs['n_words']

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





class 							_UpperCAmelCase       (       _UpperCamelCase       ):

  """simple docstring"""


  @property
  def 							lowercase						(							self					:						int	)				->		Mapping[str, Mapping[int, str]]:
     if self.task == "multiple-choice":
        __lowerCAmelCase				      =      {0: 'batch', 1: 'choice', 2: 'sequence'}
     else:
        __lowerCAmelCase				      =      {0: 'batch', 1: 'sequence'}
     return OrderedDict(
         [
             ('input_ids', dynamic_axis),
             ('attention_mask', dynamic_axis),
             ('token_type_ids', dynamic_axis),
         ]	)



"""simple docstring"""






from typing import TYPE_CHECKING

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


_lowercase							=				{
    '''configuration_mask2former''': [
        '''MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''Mask2FormerConfig''',
    ],
}

try:
					if not is_vision_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					_lowercase							=				['''Mask2FormerImageProcessor''']

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					_lowercase							=				[
					    '''MASK2FORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
					    '''Mask2FormerForUniversalSegmentation''',
					    '''Mask2FormerModel''',
					    '''Mask2FormerPreTrainedModel''',
					]

if TYPE_CHECKING:
					from .configuration_maskaformer import MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, MaskaFormerConfig

					try:
										if not is_vision_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .image_processing_maskaformer import MaskaFormerImageProcessor

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_maskaformer import (
										    MASK2FORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
										    MaskaFormerForUniversalSegmentation,
										    MaskaFormerModel,
										    MaskaFormerPreTrainedModel,
										)


else:
					import sys

					_lowercase							=				_LazyModule(__name__, globals()['''__file__'''], _import_structure)





