




from collections import OrderedDict
from typing import Mapping

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


_lowerCamelCase			:	List[Any]							 =     logging.get_logger(__name__)

_lowerCamelCase			:	Dict							 =     {
    """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'''






    UpperCAmelCase__													=   '''xlm'''
    UpperCAmelCase__													=   {
        '''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      ,				UpperCAmelCase__   :			Optional[Any]=30_145      ,				UpperCAmelCase__   :			List[str]=2_048      ,				UpperCAmelCase__   :			str=12      ,				UpperCAmelCase__   :			List[Any]=16      ,				UpperCAmelCase__   :			Dict=0.1      ,				UpperCAmelCase__   :			Tuple=0.1      ,				UpperCAmelCase__   :			str=True      ,				UpperCAmelCase__   :			Union[str, Any]=False      ,				UpperCAmelCase__   :			str=False      ,				UpperCAmelCase__   :			Optional[int]=False      ,				UpperCAmelCase__   :			List[str]=1      ,				UpperCAmelCase__   :			List[Any]=True      ,				UpperCAmelCase__   :			Union[str, Any]=512      ,				UpperCAmelCase__   :			List[str]=2_048**-0.5      ,				UpperCAmelCase__   :			List[Any]=1e-12      ,				UpperCAmelCase__   :			Any=0.02      ,				UpperCAmelCase__   :			str=0      ,				UpperCAmelCase__   :			int=1      ,				UpperCAmelCase__   :			Union[str, Any]=2      ,				UpperCAmelCase__   :			List[Any]=3      ,				UpperCAmelCase__   :			int=5      ,				UpperCAmelCase__   :			Any=True      ,				UpperCAmelCase__   :			Tuple="first"      ,				UpperCAmelCase__   :			Optional[int]=True      ,				UpperCAmelCase__   :			List[str]=None      ,				UpperCAmelCase__   :			Tuple=True      ,				UpperCAmelCase__   :			Dict=0.1      ,				UpperCAmelCase__   :			Any=5      ,				UpperCAmelCase__   :			List[Any]=5      ,				UpperCAmelCase__   :			int=0      ,				UpperCAmelCase__   :			Dict=0      ,				UpperCAmelCase__   :			Dict=2      ,				UpperCAmelCase__   :			str=0      ,				**UpperCAmelCase__   :			List[str]      ,				)		->str:





           '''simple docstring'''

           A__   				=					vocab_size
           A__   				=					emb_dim
           A__   				=					n_layers
           A__   				=					n_heads
           A__   				=					dropout
           A__   				=					attention_dropout
           A__   				=					gelu_activation
           A__   				=					sinusoidal_embeddings
           A__   				=					causal
           A__   				=					asm
           A__   				=					n_langs
           A__   				=					use_lang_emb
           A__   				=					layer_norm_eps
           A__   				=					bos_index
           A__   				=					eos_index
           A__   				=					pad_index
           A__   				=					unk_index
           A__   				=					mask_index
           A__   				=					is_encoder
           A__   				=					max_position_embeddings
           A__   				=					embed_init_std
           A__   				=					init_std
           A__   				=					summary_type
           A__   				=					summary_use_proj
           A__   				=					summary_activation
           A__   				=					summary_proj_to_labels
           A__   				=					summary_first_dropout
           A__   				=					start_n_top
           A__   				=					end_n_top
           A__   				=					mask_token_id
           A__   				=					lang_id

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

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


class        UpperCamelCase_					(				UpperCAmelCase__  ):

    '''simple docstring'''






    @property
    def  SCREAMING_SNAKE_CASE							(    self   :			Dict)		->Mapping[str, Mapping[int, str]]:





           '''simple docstring'''

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








from argparse import ArgumentParser

from . import BaseTransformersCLICommand







def SCREAMING_SNAKE_CASE       ( lowercase_		)     -> str:



       """simple docstring"""

       return DownloadCommand(args.model				,       args.cache_dir				,       args.force				,       args.trust_remote_code		)


class        UpperCamelCase_					(				UpperCAmelCase__  ):

    '''simple docstring'''






    @staticmethod
    def  SCREAMING_SNAKE_CASE							(    UpperCAmelCase__   :			ArgumentParser)		->Any:





           '''simple docstring'''

           A__   				=					parser.add_parser('''download''')
           download_parser.add_argument(
               '''--cache-dir'''      ,				type=UpperCAmelCase__      ,				default=UpperCAmelCase__      ,				help='''Path to location to store the models''')
           download_parser.add_argument(
               '''--force'''      ,				action='''store_true'''      ,				help='''Force the model to be download even if already in cache-dir''')
           download_parser.add_argument(
               '''--trust-remote-code'''      ,				action='''store_true'''      ,				help='''Whether or not to allow for custom models defined on the Hub in their own modeling files. Use only if you\'ve reviewed the code as it will execute on your local machine'''      ,				)
           download_parser.add_argument('''model'''      ,				type=UpperCAmelCase__      ,				help='''Name of the model to download''')
           download_parser.set_defaults(func=UpperCAmelCase__)


    def __init__(    self   :			Dict      ,				UpperCAmelCase__   :			str      ,				UpperCAmelCase__   :			str      ,				UpperCAmelCase__   :			bool      ,				UpperCAmelCase__   :			bool)		->int:





           '''simple docstring'''

           A__   				=					model
           A__   				=					cache
           A__   				=					force
           A__   				=					trust_remote_code





    def  SCREAMING_SNAKE_CASE							(    self   :			str)		->Union[str, Any]:





           '''simple docstring'''

           from ..models.auto import AutoModel, AutoTokenizer

           AutoModel.from_pretrained(
               self._model      ,				cache_dir=self._cache      ,				force_download=self._force      ,				trust_remote_code=self._trust_remote_code)
           AutoTokenizer.from_pretrained(
               self._model      ,				cache_dir=self._cache      ,				force_download=self._force      ,				trust_remote_code=self._trust_remote_code)


