





'''simple docstring'''



from collections import OrderedDict
from typing import Mapping

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


_SCREAMING_SNAKE_CASE					=    logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE					=    {
    '''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 							__lowercase       (      lowerCAmelCase__						):







	'''simple docstring'''

	a    :				str											=       "xlm"
	a    :				Tuple											=       {
	    "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=30145     ,_lowerCamelCase=2048     ,_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=2048**-0.5     ,_lowerCamelCase=1E-1_2     ,_lowerCamelCase=0.0_2     ,_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     ,)							->							List[str]:







				'''simple docstring'''





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

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

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






class 							__lowercase       (      lowerCAmelCase__						):







	'''simple docstring'''

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







				'''simple docstring'''





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












'''simple docstring'''



import math




def    _lowerCAmelCase						(				lowerCamelCase_			:  int				):
			assert isinstance(lowerCamelCase_		,       lowerCamelCase_				) and (
			    number >= 0
			), "'number' must been an int and positive"

			if 1 < number < 4:
						# 2 and 3 are primes
						return True
			elif number < 2 or not number % 2:
						# Negatives, 0, 1 and all even numbers are not primes
						return False

			__lowercase										=							range(3		,       int(math.sqrt(lowerCamelCase_				) + 1				)		,       2				)
			return not any(not number % i for i in odd_numbers				)




def    _lowerCAmelCase						(				lowerCamelCase_			:  Dict		,       lowerCamelCase_			:  Any=1		,       **lowerCamelCase_			:  Tuple				):
			__lowercase										=							factor * value
			__lowercase										=							value

			while not is_prime(lowerCamelCase_				):
						value += 1 if not ("desc" in kwargs and kwargs["desc"] is True) else -1

			if value == first_value_val:
						return next_prime(value + 1		,       **lowerCamelCase_				)
			return value





