






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     a    ( lowercase__   ):



      """simple docstring"""


      a  : str							       =	'swin2sr'

      a  : List[Any]							       =	{
          'hidden_size': 'embed_dim',
          'num_attention_heads': 'num_heads',
          'num_hidden_layers': 'num_layers',
      }
      def __init__(      self					:			int		,      __lowercase					:			Optional[Any]=64		,      __lowercase					:			int=1		,      __lowercase					:			Dict=3		,      __lowercase					:			List[Any]=180		,      __lowercase					:			Tuple=[6, 6, 6, 6, 6, 6]		,      __lowercase					:			int=[6, 6, 6, 6, 6, 6]		,      __lowercase					:			Optional[Any]=8		,      __lowercase					:			Any=2.0		,      __lowercase					:			Optional[Any]=True		,      __lowercase					:			int=0.0		,      __lowercase					:			str=0.0		,      __lowercase					:			Any=0.1		,      __lowercase					:			List[Any]="gelu"		,      __lowercase					:			Union[str, Any]=False		,      __lowercase					:			Optional[int]=0.02		,      __lowercase					:			str=1e-5		,      __lowercase					:			Dict=2		,      __lowercase					:			Union[str, Any]=1.0		,      __lowercase					:			int="1conv"		,      __lowercase					:			Dict="pixelshuffle"		,      **__lowercase					:			List[str]		,      )							->      str:
        super().__init__(**__lowercase					)

        __UpperCAmelCase							:	int           =  image_size
        __UpperCAmelCase							:	int           =  patch_size
        __UpperCAmelCase							:	List[Any]           =  num_channels
        __UpperCAmelCase							:	Union[str, Any]           =  embed_dim
        __UpperCAmelCase							:	Any           =  depths
        __UpperCAmelCase							:	int           =  len(__lowercase					)
        __UpperCAmelCase							:	Tuple           =  num_heads
        __UpperCAmelCase							:	List[str]           =  window_size
        __UpperCAmelCase							:	int           =  mlp_ratio
        __UpperCAmelCase							:	Union[str, Any]           =  qkv_bias
        __UpperCAmelCase							:	Optional[int]           =  hidden_dropout_prob
        __UpperCAmelCase							:	List[str]           =  attention_probs_dropout_prob
        __UpperCAmelCase							:	Union[str, Any]           =  drop_path_rate
        __UpperCAmelCase							:	Any           =  hidden_act
        __UpperCAmelCase							:	Dict           =  use_absolute_embeddings
        __UpperCAmelCase							:	List[str]           =  layer_norm_eps
        __UpperCAmelCase							:	Dict           =  initializer_range
        __UpperCAmelCase							:	List[str]           =  upscale
        __UpperCAmelCase							:	Tuple           =  img_range
        __UpperCAmelCase							:	List[Any]           =  resi_connection
        __UpperCAmelCase							:	Dict           =  upsampler










import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin
class     a    ( lowercase__   ):



      """simple docstring"""


      a  : List[str]							       =	'MCTCTFeatureExtractor'
      a  : str							       =	'AutoTokenizer'
      def __init__(      self					:			Tuple		,      __lowercase					:			int		,      __lowercase					:			Dict					)							->      Any:
        super().__init__(__lowercase		,      __lowercase					)
        __UpperCAmelCase							:	Optional[Any]           =  self.feature_extractor
        __UpperCAmelCase							:	Optional[int]           =  False
      def __call__(      self					:			int		,      *__lowercase					:			Tuple		,      **__lowercase					:			Optional[int]					)							->      Union[str, Any]:
        # For backward compatibility
        if self._in_target_context_manager:
          return self.current_processor(*__lowercase		,      **__lowercase					)

        if "raw_speech" in kwargs:
          warnings.warn("""Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead."""					)
          __UpperCAmelCase							:	Dict           =  kwargs.pop("""raw_speech"""					)
        else:
          __UpperCAmelCase							:	Dict           =  kwargs.pop("""audio"""		,      __lowercase					)
        __UpperCAmelCase							:	List[str]           =  kwargs.pop("""sampling_rate"""		,      __lowercase					)
        __UpperCAmelCase							:	Tuple           =  kwargs.pop("""text"""		,      __lowercase					)
        if len(__lowercase					) > 0:
          __UpperCAmelCase							:	Tuple           =  args[0]
          __UpperCAmelCase							:	str           =  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:
          __UpperCAmelCase							:	Tuple           =  self.feature_extractor(__lowercase		,      *__lowercase		,      sampling_rate=__lowercase		,      **__lowercase					)
        if text is not None:
          __UpperCAmelCase							:	str           =  self.tokenizer(__lowercase		,      **__lowercase					)

        if text is None:
          return inputs
        elif audio is None:
          return encodings
        else:
          __UpperCAmelCase							:	Dict           =  encodings["""input_ids"""]
          return inputs
      def 	UpperCAmelCase      (      self					:			Optional[Any]		,      *__lowercase					:			List[Any]		,      **__lowercase					:			int					)							->      List[Any]:
        return self.tokenizer.batch_decode(*__lowercase		,      **__lowercase					)
      def 	UpperCAmelCase      (      self					:			Optional[int]		,      *__lowercase					:			Optional[Any]		,      **__lowercase					:			List[str]					)							->      int:
        # For backward compatibility
        if self._in_target_context_manager:
          return self.current_processor.pad(*__lowercase		,      **__lowercase					)

        __UpperCAmelCase							:	Optional[int]           =  kwargs.pop("""input_features"""		,      __lowercase					)
        __UpperCAmelCase							:	Optional[Any]           =  kwargs.pop("""labels"""		,      __lowercase					)
        if len(__lowercase					) > 0:
          __UpperCAmelCase							:	Union[str, Any]           =  args[0]
          __UpperCAmelCase							:	str           =  args[1:]

        if input_features is not None:
          __UpperCAmelCase							:	Any           =  self.feature_extractor.pad(__lowercase		,      *__lowercase		,      **__lowercase					)
        if labels is not None:
          __UpperCAmelCase							:	Union[str, Any]           =  self.tokenizer.pad(__lowercase		,      **__lowercase					)

        if labels is None:
          return input_features
        elif input_features is None:
          return labels
        else:
          __UpperCAmelCase							:	Any           =  labels["""input_ids"""]
          return input_features
      def 	UpperCAmelCase      (      self					:			Any		,      *__lowercase					:			Union[str, Any]		,      **__lowercase					:			Dict					)							->      List[Any]:
        return self.tokenizer.decode(*__lowercase		,      **__lowercase					)




      @contextmanager
      def 	UpperCAmelCase      (      self					:			Optional[Any]					)							->      Tuple:
        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."""					)
        __UpperCAmelCase							:	Any           =  True
        __UpperCAmelCase							:	Optional[int]           =  self.tokenizer
        yield
        __UpperCAmelCase							:	List[Any]           =  self.feature_extractor
        __UpperCAmelCase							:	int           =  False


