

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


A_	:			List[Any]  	=      logging.get_logger(__name__)

A_	:			Union[str, Any]  	=      {
    'microsoft/swinv2-tiny-patch4-window8-256': (
        'https://huggingface.co/microsoft/swinv2-tiny-patch4-window8-256/resolve/main/config.json'
    ),
}



class    _a						(__SCREAMING_SNAKE_CASE    ):


					'''simple docstring'''






					UpperCAmelCase__:       Tuple  							=	"swinv2"

					UpperCAmelCase__:       List[Any]  							=	{
					    "num_attention_heads": "num_heads",
					    "num_hidden_layers": "num_layers",
					}






					def __init__(			self   ,	A__=224   ,	A__=4   ,	A__=3   ,	A__=96   ,	A__=[2, 2, 6, 2]   ,	A__=[3, 6, 12, 24]   ,	A__=7   ,	A__=4.0   ,	A__=True   ,	A__=0.0   ,	A__=0.0   ,	A__=0.1   ,	A__="gelu"   ,	A__=False   ,	A__=0.0_2   ,	A__=1e-5   ,	A__=32   ,	**A__   ,	):
						super().__init__(**_snake_case      )

						A__							:   int					       =		image_size
						A__							:   List[Any]					       =		patch_size
						A__							:   Dict					       =		num_channels
						A__							:   List[Any]					       =		embed_dim
						A__							:   Union[str, Any]					       =		depths
						A__							:   Tuple					       =		len(_snake_case      )
						A__							:   str					       =		num_heads
						A__							:   Dict					       =		window_size
						A__							:   List[str]					       =		mlp_ratio
						A__							:   List[Any]					       =		qkv_bias
						A__							:   int					       =		hidden_dropout_prob
						A__							:   List[str]					       =		attention_probs_dropout_prob
						A__							:   Union[str, Any]					       =		drop_path_rate
						A__							:   Optional[int]					       =		hidden_act
						A__							:   Optional[int]					       =		use_absolute_embeddings
						A__							:   List[str]					       =		layer_norm_eps
						A__							:   Optional[Any]					       =		initializer_range
						A__							:   List[Any]					       =		encoder_stride
						# we set the hidden_size attribute in order to make Swinv2 work with VisionEncoderDecoderModel
						# this indicates the channel dimension after the last stage of the model
						A__							:   Optional[Any]					       =		int(embed_dim * 2 ** (len(_snake_case      ) - 1)      )
						A__							:   Optional[int]					       =		(0, 0, 0, 0)






import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin



class    _a						(__magic_name__    ):


					'''simple docstring'''






					UpperCAmelCase__:       Optional[Any]  							=	'''MCTCTFeatureExtractor'''
					UpperCAmelCase__:       Optional[int]  							=	'''AutoTokenizer'''






					def __init__(			self   ,	A__   ,	A__      ):
						super().__init__(A__   ,	A__      )
						A__							:   List[str]					       =		self.feature_extractor
						A__							:   Optional[int]					       =		False






					def __call__(			self   ,	*A__   ,	**A__      ):
						# For backward compatibility
						if self._in_target_context_manager:
							return self.current_processor(*A__   ,	**A__      )

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

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






					def   __A      (			self   ,	*A__   ,	**A__      ):
						return self.tokenizer.batch_decode(*A__   ,	**A__      )






					def   __A      (			self   ,	*A__   ,	**A__      ):
						# For backward compatibility
						if self._in_target_context_manager:
							return self.current_processor.pad(*A__   ,	**A__      )

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

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

						if labels is None:
							return input_features
						elif input_features is None:
							return labels
						else:
							A__							:   Dict					       =		labels["""input_ids"""]
							return input_features






					def   __A      (			self   ,	*A__   ,	**A__      ):
						return self.tokenizer.decode(*A__   ,	**A__      )






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



