





'''simple docstring'''






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


A   : List[str]             =			{
    'configuration_swinv2': ['SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Swinv2Config'],
}


try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		A   : Any             =			[
		    'SWINV2_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'Swinv2ForImageClassification',
		    'Swinv2ForMaskedImageModeling',
		    'Swinv2Model',
		    'Swinv2PreTrainedModel',
		]


if TYPE_CHECKING:
		from .configuration_swinva import SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP, SwinvaConfig

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_swinva import (
				    SWINV2_PRETRAINED_MODEL_ARCHIVE_LIST,
				    SwinvaForImageClassification,
				    SwinvaForMaskedImageModeling,
				    SwinvaModel,
				    SwinvaPreTrainedModel,
				)


else:
		import sys

		A   : Any             =			_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)












'''simple docstring'''






import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin







class 			lowerCamelCase					(						__UpperCAmelCase  ):
					_SCREAMING_SNAKE_CASE							   =    "Speech2TextFeatureExtractor"
					_SCREAMING_SNAKE_CASE							   =    "Speech2TextTokenizer"


					def __init__(					self	:  List[str]       ,     __snake_case	:  Union[str, Any]       ,     __snake_case	:  List[str]       ):





											'''simple docstring'''





											super().__init__(__snake_case       ,     __snake_case       )
											_snake_case:   Optional[int]  					=		self.feature_extractor
											_snake_case:   Dict  					=		False


					def __call__(					self	:  Optional[int]       ,     *__snake_case	:  Optional[Any]       ,     **__snake_case	:  Union[str, Any]       ):





											'''simple docstring'''





											if self._in_target_context_manager:
																	return self.current_processor(*__snake_case       ,     **__snake_case       )

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

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


					def    SCREAMING_SNAKE_CASE_		(					self	:  Dict       ,     *__snake_case	:  Optional[int]       ,     **__snake_case	:  str       ):





											'''simple docstring'''





											return self.tokenizer.batch_decode(*__snake_case       ,     **__snake_case       )


					def    SCREAMING_SNAKE_CASE_		(					self	:  Dict       ,     *__snake_case	:  List[str]       ,     **__snake_case	:  Tuple       ):





											'''simple docstring'''





											return self.tokenizer.decode(*__snake_case       ,     **__snake_case       )




					@contextmanager
					def    SCREAMING_SNAKE_CASE_		(					self	:  List[str]       ):





											'''simple docstring'''





											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.'       )
											_snake_case:   Any  					=		True
											_snake_case:   str  					=		self.tokenizer
											yield
											_snake_case:   Union[str, Any]  					=		self.feature_extractor
											_snake_case:   Tuple  					=		False





