





'''simple docstring'''




from collections import OrderedDict
from typing import Mapping

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


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

lowercase__   :				Optional[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 			SCREAMING_SNAKE_CASE   (_lowerCamelCase							):
     lowerCAmelCase		      =	'''xlm-roberta-xl'''


     def __init__(						self						,     _UpperCAmelCase=25_0880						,     _UpperCAmelCase=2560						,     _UpperCAmelCase=36						,     _UpperCAmelCase=32						,     _UpperCAmelCase=1_0240						,     _UpperCAmelCase="gelu"						,     _UpperCAmelCase=0.1						,     _UpperCAmelCase=0.1						,     _UpperCAmelCase=514						,     _UpperCAmelCase=1						,     _UpperCAmelCase=0.02						,     _UpperCAmelCase=1e-0_5						,     _UpperCAmelCase=1						,     _UpperCAmelCase=0						,     _UpperCAmelCase=2						,     _UpperCAmelCase="absolute"						,     _UpperCAmelCase=True						,     _UpperCAmelCase=None						,     **_UpperCAmelCase						,     ):

          '''simple docstring'''






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




class 			SCREAMING_SNAKE_CASE   (_lowerCamelCase							):


     @property
     def 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






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






'''simple docstring'''




from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding


class 			SCREAMING_SNAKE_CASE   (a__							):
     lowerCAmelCase		      =	['''image_processor''', '''tokenizer''']
     lowerCAmelCase		      =	'''AutoImageProcessor'''
     lowerCAmelCase		      =	'''AutoTokenizer'''


     def __init__(						self						,     _UpperCAmelCase						,     _UpperCAmelCase):

          '''simple docstring'''






          super().__init__(_UpperCAmelCase						,     _UpperCAmelCase)
          __A						:			Tuple								=	self.image_processor


     def __call__(						self						,     _UpperCAmelCase=None						,     _UpperCAmelCase=None						,     _UpperCAmelCase=None						,     **_UpperCAmelCase):

          '''simple docstring'''






          if text is None and images is None:
               raise ValueError('You have to specify either text or images. Both cannot be none.')

          if text is not None:
               __A						:			Any								=	self.tokenizer(_UpperCAmelCase						,     return_tensors=_UpperCAmelCase						,     **_UpperCAmelCase)

          if images is not None:
               __A						:			Tuple								=	self.image_processor(_UpperCAmelCase						,     return_tensors=_UpperCAmelCase						,     **_UpperCAmelCase)

          if text is not None and images is not None:
               __A						:			Optional[int]								=	image_features.pixel_values
               return encoding
          elif text is not None:
               return encoding
          else:
               return BatchEncoding(data=dict(**_UpperCAmelCase)						,     tensor_type=_UpperCAmelCase)


     def 							SCREAMING_SNAKE_CASE  (						self						,     *_UpperCAmelCase						,     **_UpperCAmelCase):

          '''simple docstring'''






          return self.tokenizer.batch_decode(*_UpperCAmelCase						,     **_UpperCAmelCase)


     def 							SCREAMING_SNAKE_CASE  (						self						,     *_UpperCAmelCase						,     **_UpperCAmelCase):

          '''simple docstring'''






          return self.tokenizer.decode(*_UpperCAmelCase						,     **_UpperCAmelCase)


     @property
     def 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






          return ["input_ids", "attention_mask", "pixel_values"]