



'''simple docstring'''
import os
import sys
import unittest


snake_case_			:     Optional[Any]  	=  os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
sys.path.append(os.path.join(git_repo_path, 'utils'))

import check_dummies  # noqa: E402
from check_dummies import create_dummy_files, create_dummy_object, find_backend, read_init  # noqa: E402


# Align TRANSFORMERS_PATH in check_dummies with the current path
snake_case_			:     Dict  	=  os.path.join(git_repo_path, 'src', 'transformers')

snake_case_			:     Optional[int]  	=  '\n{0} = None\n'

snake_case_			:     Union[str, Any]  	=  '\nclass {0}(metaclass=DummyObject):\n    _backends = {1}\n\n    def __init__(self, *args, **kwargs):\n        requires_backends(self, {1})\n'


snake_case_			:     Optional[int]  	=  '\ndef {0}(*args, **kwargs):\n    requires_backends({0}, {1})\n'






class 							lowercase__     (							unittest.TestCase       ):





	def      UpperCamelCase_  (			self :    Tuple			):







							'''simple docstring'''
							_UpperCamelCase :		List[str]			    =       find_backend('    _import_structure["models.albert"].append("AlbertTokenizerFast")'			)
							self.assertIsNone(lowerCamelCase__			)

							_UpperCamelCase :		int			    =       find_backend('    if not is_tokenizers_available():'			)
							self.assertEqual(lowerCamelCase__			,'tokenizers'			)

							_UpperCamelCase :		Optional[int]			    =       find_backend('    if not is_tensorflow_text_available():'			)
							self.assertEqual(lowerCamelCase__			,'tensorflow_text'			)

							_UpperCamelCase :		int			    =       find_backend('    if not (is_sentencepiece_available() and is_tokenizers_available()):'			)
							self.assertEqual(lowerCamelCase__			,'sentencepiece_and_tokenizers'			)

							_UpperCamelCase :		Optional[int]			    =       find_backend(
							    '    if not (is_sentencepiece_available() and is_tensorflow_text_available()):'			)
							self.assertEqual(lowerCamelCase__			,'sentencepiece_and_tensorflow_text'			)

							_UpperCamelCase :		Optional[Any]			    =       find_backend(
							    '    if not (is_sentencepiece_available() and is_tokenizers_available() and is_vision_available()):'			)
							self.assertEqual(lowerCamelCase__			,'sentencepiece_and_tokenizers_and_vision'			)





	def      UpperCamelCase_  (			self :    Union[str, Any]			):







							'''simple docstring'''
							_UpperCamelCase :		int			    =       read_init()
							# We don't assert on the exact list of keys to allow for smooth grow of backend-specific objects
							self.assertIn('torch'			,lowerCamelCase__			)
							self.assertIn('tensorflow_text'			,lowerCamelCase__			)
							self.assertIn('sentencepiece_and_tokenizers'			,lowerCamelCase__			)

							# Likewise, we can't assert on the exact content of a key
							self.assertIn('BertModel'			,objects['torch']			)
							self.assertIn('TFBertModel'			,objects['tf']			)
							self.assertIn('FlaxBertModel'			,objects['flax']			)
							self.assertIn('BertModel'			,objects['torch']			)
							self.assertIn('TFBertTokenizer'			,objects['tensorflow_text']			)
							self.assertIn('convert_slow_tokenizer'			,objects['sentencepiece_and_tokenizers']			)





	def      UpperCamelCase_  (			self :    int			):







							'''simple docstring'''
							_UpperCamelCase :		Any			    =       create_dummy_object('CONSTANT'			,'\'torch\''			)
							self.assertEqual(lowerCamelCase__			,'\nCONSTANT = None\n'			)

							_UpperCamelCase :		List[Any]			    =       create_dummy_object('function'			,'\'torch\''			)
							self.assertEqual(
							    lowerCamelCase__			,'\ndef function(*args, **kwargs):\n    requires_backends(function, \'torch\')\n'			)

							_UpperCamelCase :		Any			    =       '\nclass FakeClass(metaclass=DummyObject):\n    _backends = \'torch\'\n\n    def __init__(self, *args, **kwargs):\n        requires_backends(self, \'torch\')\n'
							_UpperCamelCase :		Dict			    =       create_dummy_object('FakeClass'			,'\'torch\''			)
							self.assertEqual(lowerCamelCase__			,lowerCamelCase__			)





	def      UpperCamelCase_  (			self :    Optional[Any]			):







							'''simple docstring'''
							_UpperCamelCase :		int			    =       '# This file is autogenerated by the command `make fix-copies`, do not edit.\nfrom ..utils import DummyObject, requires_backends\n\n\nCONSTANT = None\n\n\ndef function(*args, **kwargs):\n    requires_backends(function, ["torch"])\n\n\nclass FakeClass(metaclass=DummyObject):\n    _backends = ["torch"]\n\n    def __init__(self, *args, **kwargs):\n        requires_backends(self, ["torch"])\n'
							_UpperCamelCase :		int			    =       create_dummy_files({'torch': ['CONSTANT', 'function', 'FakeClass']}			)
							self.assertEqual(dummy_files['torch']			,lowerCamelCase__			)







'''simple docstring'''
from collections import OrderedDict
from typing import Mapping

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


snake_case_			:     Optional[int]  	=  logging.get_logger(__name__)

snake_case_			:     List[Any]  	=  {
    'facebook/xlm-roberta-xl': 'https://huggingface.co/facebook/xlm-roberta-xl/resolve/main/config.json',
    'facebook/xlm-roberta-xxl': 'https://huggingface.co/facebook/xlm-roberta-xxl/resolve/main/config.json',
    # See all XLM-RoBERTa-XL models at https://huggingface.co/models?filter=xlm-roberta-xl
}






class 							lowercase__     (							lowercase       ):
	lowercase__      =      """xlm-roberta-xl"""





	def __init__(			self :    Optional[int]			,lowerCamelCase__ :    Optional[Any]=250880			,lowerCamelCase__ :    Tuple=2560			,lowerCamelCase__ :    Union[str, Any]=36			,lowerCamelCase__ :    List[str]=32			,lowerCamelCase__ :    Optional[Any]=10240			,lowerCamelCase__ :    Tuple="gelu"			,lowerCamelCase__ :    int=0.1			,lowerCamelCase__ :    int=0.1			,lowerCamelCase__ :    Optional[int]=514			,lowerCamelCase__ :    List[str]=1			,lowerCamelCase__ :    Dict=0.0_2			,lowerCamelCase__ :    Any=1E-05			,lowerCamelCase__ :    Union[str, Any]=1			,lowerCamelCase__ :    str=0			,lowerCamelCase__ :    Tuple=2			,lowerCamelCase__ :    Union[str, Any]="absolute"			,lowerCamelCase__ :    Optional[Any]=True			,lowerCamelCase__ :    List[str]=None			,**lowerCamelCase__ :    Dict			,):







							'''simple docstring'''
							super().__init__(pad_token_id=lowerCamelCase__			,bos_token_id=lowerCamelCase__			,eos_token_id=lowerCamelCase__			,**lowerCamelCase__			)
							_UpperCamelCase :		Optional[int]			    =       vocab_size
							_UpperCamelCase :		Optional[Any]			    =       hidden_size
							_UpperCamelCase :		str			    =       num_hidden_layers
							_UpperCamelCase :		str			    =       num_attention_heads
							_UpperCamelCase :		Any			    =       hidden_act
							_UpperCamelCase :		Dict			    =       intermediate_size
							_UpperCamelCase :		Optional[int]			    =       hidden_dropout_prob
							_UpperCamelCase :		Any			    =       attention_probs_dropout_prob
							_UpperCamelCase :		List[Any]			    =       max_position_embeddings
							_UpperCamelCase :		str			    =       type_vocab_size
							_UpperCamelCase :		Optional[Any]			    =       initializer_range
							_UpperCamelCase :		Optional[int]			    =       layer_norm_eps
							_UpperCamelCase :		Optional[int]			    =       position_embedding_type
							_UpperCamelCase :		Optional[Any]			    =       use_cache
							_UpperCamelCase :		Optional[Any]			    =       classifier_dropout






class 							lowercase__     (							lowercase       ):





	@property
	def      UpperCamelCase_  (			self :    List[Any]			):







							'''simple docstring'''
							if self.task == "multiple-choice":
													_UpperCamelCase :		Union[str, Any]			    =       {0: 'batch', 1: 'choice', 2: 'sequence'}
							else:
													_UpperCamelCase :		Optional[Any]			    =       {0: 'batch', 1: 'sequence'}
							return OrderedDict(
							    [
							        ('input_ids', dynamic_axis),
							        ('attention_mask', dynamic_axis),
							    ]			)


