






"""simple docstring"""







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       :	str             = logging.get_logger(__name__)







class        _SCREAMING_SNAKE_CASE						(  __snake_case							):





							"""simple docstring"""





							_SCREAMING_SNAKE_CASE    ='vision-encoder-decoder'
							_SCREAMING_SNAKE_CASE    =True




							def __init__(   self:     Dict				,		**__A:     Tuple    ):

												'''simple docstring'''

												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__          =  kwargs.pop('''encoder'''    )
												a__          =  encoder_config.pop('''model_type'''    )
												a__          =  kwargs.pop('''decoder'''    )
												a__          =  decoder_config.pop('''model_type'''    )

												a__          =  AutoConfig.for_model(__A				,		**__A    )
												a__          =  AutoConfig.for_model(__A				,		**__A    )
												a__          =  True




							@classmethod
							def  lowercase		(   cls:     Union[str, Any]				,		__A:     PretrainedConfig				,		__A:     PretrainedConfig				,		**__A:     str    ):

												'''simple docstring'''

												logger.info('''Setting `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config'''    )
												a__          =  True
												a__          =  True

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





							def  lowercase		(   self:     Optional[Any]    ):

												'''simple docstring'''

												a__          =  copy.deepcopy(self.__dict__    )
												a__          =  self.encoder.to_dict()
												a__          =  self.decoder.to_dict()
												a__          =  self.__class__.model_type
												return output







class        _SCREAMING_SNAKE_CASE						(  __snake_case							):





							"""simple docstring"""





							_SCREAMING_SNAKE_CASE    =version.parse('1.11'							)




							@property
							def  lowercase		(   self:     Any    ):

												'''simple docstring'''

												return OrderedDict(
												    [
												        ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
												    ]    )




							@property
							def  lowercase		(   self:     Tuple    ):

												'''simple docstring'''

												return 1e-4





							@property
							def  lowercase		(   self:     str    ):

												'''simple docstring'''

												return OrderedDict({'''last_hidden_state''': {0: '''batch''', 1: '''encoder_sequence'''}}    )







class        _SCREAMING_SNAKE_CASE						(  __snake_case							):





							"""simple docstring"""





							@property
							def  lowercase		(   self:     int    ):

												'''simple docstring'''

												a__          =  OrderedDict()
												a__          =  {0: '''batch''', 1: '''past_decoder_sequence + sequence'''}
												a__          =  {0: '''batch''', 1: '''past_decoder_sequence + sequence'''}
												a__          =  {0: '''batch''', 1: '''encoder_sequence'''}

												return common_inputs





							def  lowercase		(   self:     List[Any]				,		__A:     "PreTrainedTokenizerBase"				,		__A:     int = -1				,		__A:     int = -1				,		__A:     bool = False				,		__A:     Optional["TensorType"] = None				,		):

												'''simple docstring'''

												import torch

												a__          =  OrderedDict()

												a__          =  super().generate_dummy_inputs(
												    __A				,		batch_size=__A				,		seq_length=__A				,		is_pair=__A				,		framework=__A    )

												a__       ,a__          =  dummy_input['''input_ids'''].shape
												a__          =  (batch, encoder_sequence, self._config.encoder_hidden_size)
												a__          =  dummy_input.pop('''input_ids'''    )
												a__          =  dummy_input.pop('''attention_mask'''    )
												a__          =  torch.zeros(__A    )

												return common_inputs







class        _SCREAMING_SNAKE_CASE						(  __snake_case							):





							"""simple docstring"""





							@property
							def  lowercase		(   self:     str    ):

												'''simple docstring'''

												pass




							def  lowercase		(   self:     str				,		__A:     PretrainedConfig    ):

												'''simple docstring'''

												return VisionEncoderDecoderEncoderOnnxConfig(__A    )





							def  lowercase		(   self:     List[str]				,		__A:     PretrainedConfig				,		__A:     PretrainedConfig				,		__A:     str = "default"    ):

												'''simple docstring'''

												a__          =  encoder_config.hidden_size
												return VisionEncoderDecoderDecoderOnnxConfig(__A				,		__A    )










"""simple docstring"""







from ...configuration_utils import PretrainedConfig
from ...utils import logging


__a       :	Any             = logging.get_logger(__name__)

__a       :	Union[str, Any]             = {
    'caidas/swin2sr-classicalsr-x2-64': (
        'https://huggingface.co/caidas/swin2sr-classicalsr-x2-64/resolve/main/config.json'
    ),
}







class        _SCREAMING_SNAKE_CASE						(  __snake_case							):





							"""simple docstring"""





							_SCREAMING_SNAKE_CASE    ='swin2sr'

							_SCREAMING_SNAKE_CASE    ={
							    'hidden_size': 'embed_dim',
							    'num_attention_heads': 'num_heads',
							    'num_hidden_layers': 'num_layers',
							}




							def __init__(   self:     Union[str, Any]				,		__A:     List[Any]=64				,		__A:     int=1				,		__A:     Dict=3				,		__A:     List[Any]=180				,		__A:     int=[6, 6, 6, 6, 6, 6]				,		__A:     Tuple=[6, 6, 6, 6, 6, 6]				,		__A:     int=8				,		__A:     Optional[int]=2.0				,		__A:     Optional[int]=True				,		__A:     int=0.0				,		__A:     Any=0.0				,		__A:     Optional[Any]=0.1				,		__A:     Optional[Any]="gelu"				,		__A:     Dict=False				,		__A:     List[Any]=0.0_2				,		__A:     List[Any]=1e-5				,		__A:     List[str]=2				,		__A:     int=1.0				,		__A:     Dict="1conv"				,		__A:     Optional[Any]="pixelshuffle"				,		**__A:     Dict				,		):

												'''simple docstring'''

												super().__init__(**__A    )

												a__          =  image_size
												a__          =  patch_size
												a__          =  num_channels
												a__          =  embed_dim
												a__          =  depths
												a__          =  len(__A    )
												a__          =  num_heads
												a__          =  window_size
												a__          =  mlp_ratio
												a__          =  qkv_bias
												a__          =  hidden_dropout_prob
												a__          =  attention_probs_dropout_prob
												a__          =  drop_path_rate
												a__          =  hidden_act
												a__          =  use_absolute_embeddings
												a__          =  layer_norm_eps
												a__          =  initializer_range
												a__          =  upscale
												a__          =  img_range
												a__          =  resi_connection
												a__          =  upsampler


