

import copy
from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ..auto.configuration_auto import AutoConfig


if TYPE_CHECKING:
	from ... import PreTrainedTokenizerBase, TensorType

A_			:					Dict    			=     logging.get_logger(__name__)



class        _a		(__magic_name__							):


					'''simple docstring'''






					UpperCAmelCase__:  Dict    				=			'''vision-encoder-decoder'''
					UpperCAmelCase__:  int    				=			True






					def __init__(					self       ,			**A__     ):
						super().__init__(**A__     )
						if "encoder" not in kwargs or "decoder" not in kwargs:
							raise ValueError(
							    F"""A configuraton of type {self.model_type} cannot be instantiated because """
							    F"""not both `encoder` and `decoder` sub-configurations are passed, but only {kwargs}"""     )

						A__				:       Optional[int]	  =						kwargs.pop("""encoder"""     )
						A__				:       str	  =						encoder_config.pop("""model_type"""     )
						A__				:       Optional[Any]	  =						kwargs.pop("""decoder"""     )
						A__				:       str	  =						decoder_config.pop("""model_type"""     )

						A__				:       Union[str, Any]	  =						AutoConfig.for_model(A__       ,			**A__     )
						A__				:       int	  =						AutoConfig.for_model(A__       ,			**A__     )
						A__				:       str	  =						True






					@classmethod
					def     __A     (					cls       ,			A__       ,			A__       ,			**A__     ):
						logger.info("""Setting `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config"""     )
						A__				:       List[Any]	  =						True
						A__				:       Union[str, Any]	  =						True

						return cls(encoder=encoder_config.to_dict()       ,			decoder=decoder_config.to_dict()       ,			**A__     )






					def     __A     (					self     ):
						A__				:       List[Any]	  =						copy.deepcopy(self.__dict__     )
						A__				:       Union[str, Any]	  =						self.encoder.to_dict()
						A__				:       Any	  =						self.decoder.to_dict()
						A__				:       str	  =						self.__class__.model_type
						return output



class        _a		(__magic_name__							):


					'''simple docstring'''






					UpperCAmelCase__:  Any    				=			version.parse('''1.11'''							)






					@property
					def     __A     (					self     ):
						return OrderedDict(
						    [
						        ("""pixel_values""", {0: """batch""", 1: """num_channels""", 2: """height""", 3: """width"""}),
						    ]     )






					@property
					def     __A     (					self     ):
						return 1e-4






					@property
					def     __A     (					self     ):
						return OrderedDict({"""last_hidden_state""": {0: """batch""", 1: """encoder_sequence"""}}     )



class        _a		(__magic_name__							):


					'''simple docstring'''






					@property
					def     __A     (					self     ):
						A__				:       Dict	  =						OrderedDict()
						A__				:       str	  =						{0: """batch""", 1: """past_decoder_sequence + sequence"""}
						A__				:       Optional[Any]	  =						{0: """batch""", 1: """past_decoder_sequence + sequence"""}
						A__				:       List[str]	  =						{0: """batch""", 1: """encoder_sequence"""}

						return common_inputs






					def     __A     (					self       ,			A__       ,			A__ = -1       ,			A__ = -1       ,			A__ = False       ,			A__ = None       ,			):
						import torch

						A__				:       int	  =						OrderedDict()

						A__				:       Optional[Any]	  =						super().generate_dummy_inputs(
						    A__       ,			batch_size=A__       ,			seq_length=A__       ,			is_pair=A__       ,			framework=A__     )

						A__  ,  A__				:       Dict	  =						dummy_input["""input_ids"""].shape
						A__				:       Union[str, Any]	  =						(batch, encoder_sequence, self._config.encoder_hidden_size)
						A__				:       List[Any]	  =						dummy_input.pop("""input_ids"""     )
						A__				:       int	  =						dummy_input.pop("""attention_mask"""     )
						A__				:       int	  =						torch.zeros(A__     )

						return common_inputs



class        _a		(__magic_name__							):


					'''simple docstring'''






					@property
					def     __A     (					self     ):
						pass






					def     __A     (					self       ,			A__     ):
						return VisionEncoderDecoderEncoderOnnxConfig(A__     )






					def     __A     (					self       ,			A__       ,			A__       ,			A__ = "default"     ):
						A__				:       List[Any]	  =						encoder_config.hidden_size
						return VisionEncoderDecoderDecoderOnnxConfig(A__       ,			A__     )






from typing import TYPE_CHECKING

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


A_			:					Tuple    			=     {
    'configuration_xlm': ['XLM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XLMConfig', 'XLMOnnxConfig'],
    'tokenization_xlm': ['XLMTokenizer'],
}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	A_			:					Dict    			=     [
	    'XLM_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'XLMForMultipleChoice',
	    'XLMForQuestionAnswering',
	    'XLMForQuestionAnsweringSimple',
	    'XLMForSequenceClassification',
	    'XLMForTokenClassification',
	    'XLMModel',
	    'XLMPreTrainedModel',
	    'XLMWithLMHeadModel',
	]

try:
	if not is_tf_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	A_			:					str    			=     [
	    'TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'TFXLMForMultipleChoice',
	    'TFXLMForQuestionAnsweringSimple',
	    'TFXLMForSequenceClassification',
	    'TFXLMForTokenClassification',
	    'TFXLMMainLayer',
	    'TFXLMModel',
	    'TFXLMPreTrainedModel',
	    'TFXLMWithLMHeadModel',
	]


if TYPE_CHECKING:
	from .configuration_xlm import XLM_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMConfig, XLMOnnxConfig
	from .tokenization_xlm import XLMTokenizer

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_xlm import (
		    XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
		    XLMForMultipleChoice,
		    XLMForQuestionAnswering,
		    XLMForQuestionAnsweringSimple,
		    XLMForSequenceClassification,
		    XLMForTokenClassification,
		    XLMModel,
		    XLMPreTrainedModel,
		    XLMWithLMHeadModel,
		)

	try:
		if not is_tf_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_tf_xlm import (
		    TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
		    TFXLMForMultipleChoice,
		    TFXLMForQuestionAnsweringSimple,
		    TFXLMForSequenceClassification,
		    TFXLMForTokenClassification,
		    TFXLMMainLayer,
		    TFXLMModel,
		    TFXLMPreTrainedModel,
		    TFXLMWithLMHeadModel,
		)

else:
	import sys

	A_			:					Tuple    			=     _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



