




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


UpperCamelCase								=					logging.get_logger(__name__)

UpperCamelCase								=					{
    'caidas/swin2sr-classicalsr-x2-64': (
        'https://huggingface.co/caidas/swin2sr-classicalsr-x2-64/resolve/main/config.json'
    ),
}





class 			__lowerCamelCase	(   _A   ):




    """simple docstring"""

    snake_case__ =				"swin2sr"

    snake_case__ =				{
        "hidden_size": "embed_dim",
        "num_attention_heads": "num_heads",
        "num_hidden_layers": "num_layers",
    }


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

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






import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin





class 			__lowerCamelCase	(   UpperCamelCase__   ):




    """simple docstring"""

    snake_case__ =				"Speech2TextFeatureExtractor"
    snake_case__ =				"Speech2TextTokenizer"


    def __init__(	self					:					int       ,     SCREAMING_SNAKE_CASE__					:					Dict       ,     SCREAMING_SNAKE_CASE__					:					Tuple       )				->	Optional[Any]:
         super().__init__(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )
         lowerCAmelCase__          =			self.feature_extractor
         lowerCAmelCase__          =			False


    def __call__(	self					:					str       ,     *SCREAMING_SNAKE_CASE__					:					int       ,     **SCREAMING_SNAKE_CASE__					:					int       )				->	Optional[Any]:
         # For backward compatibility
         if self._in_target_context_manager:
              return self.current_processor(*SCREAMING_SNAKE_CASE__       ,     **SCREAMING_SNAKE_CASE__       )

         if "raw_speech" in kwargs:
              warnings.warn("Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead."       )
              lowerCAmelCase__          =			kwargs.pop("raw_speech"       )
         else:
              lowerCAmelCase__          =			kwargs.pop("audio"       ,     SCREAMING_SNAKE_CASE__       )
         lowerCAmelCase__          =			kwargs.pop("sampling_rate"       ,     SCREAMING_SNAKE_CASE__       )
         lowerCAmelCase__          =			kwargs.pop("text"       ,     SCREAMING_SNAKE_CASE__       )
         if len(SCREAMING_SNAKE_CASE__       ) > 0:
              lowerCAmelCase__          =			args[0]
              lowerCAmelCase__          =			args[1:]

         if audio is None and text is None:
              raise ValueError("You need to specify either an `audio` or `text` input to process."       )

         if audio is not None:
              lowerCAmelCase__          =			self.feature_extractor(SCREAMING_SNAKE_CASE__       ,     *SCREAMING_SNAKE_CASE__       ,     sampling_rate=SCREAMING_SNAKE_CASE__       ,     **SCREAMING_SNAKE_CASE__       )
         if text is not None:
              lowerCAmelCase__          =			self.tokenizer(SCREAMING_SNAKE_CASE__       ,     **SCREAMING_SNAKE_CASE__       )

         if text is None:
              return inputs
         elif audio is None:
              return encodings
         else:
              lowerCAmelCase__          =			encodings["input_ids"]
              return inputs


    def        a				(	self					:					str       ,     *SCREAMING_SNAKE_CASE__					:					Dict       ,     **SCREAMING_SNAKE_CASE__					:					int       )				->	Union[str, Any]:
         return self.tokenizer.batch_decode(*SCREAMING_SNAKE_CASE__       ,     **SCREAMING_SNAKE_CASE__       )


    def        a				(	self					:					Dict       ,     *SCREAMING_SNAKE_CASE__					:					Optional[int]       ,     **SCREAMING_SNAKE_CASE__					:					Optional[int]       )				->	Optional[Any]:
         return self.tokenizer.decode(*SCREAMING_SNAKE_CASE__       ,     **SCREAMING_SNAKE_CASE__       )


    @contextmanager
    def        a				(	self					:					Union[str, Any]       )				->	Any:
         warnings.warn(
             "`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your "
             "labels by using the argument `text` of the regular `__call__` method (either in the same call as "
             "your audio inputs, or in a separate call."       )
         lowerCAmelCase__          =			True
         lowerCAmelCase__          =			self.tokenizer
         yield
         lowerCAmelCase__          =			self.feature_extractor
         lowerCAmelCase__          =			False
