



'''simple docstring'''



import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin





class _UpperCamelCase		(     __a		):





				'''simple docstring'''





				lowerCAmelCase__					    =    """MCTCTFeatureExtractor"""
				lowerCAmelCase__					    =    """AutoTokenizer"""

				def __init__(							self  :  Optional[int]  ,       _lowerCAmelCase  :  Union[str, Any]  ,       _lowerCAmelCase  :  str):







											'''simple docstring'''

											super().__init__(A__  ,       A__)
											__lowercase       	=self.feature_extractor
											__lowercase       	=False

				def __call__(							self  :  Any  ,       *_lowerCAmelCase  :  Dict  ,       **_lowerCAmelCase  :  Any):







											'''simple docstring'''

											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.')
																		__lowercase       	=kwargs.pop('raw_speech')
											else:
																		__lowercase       	=kwargs.pop('audio'  ,       A__)
											__lowercase       	=kwargs.pop('sampling_rate'  ,       A__)
											__lowercase       	=kwargs.pop('text'  ,       A__)
											if len(A__) > 0:
																		__lowercase       	=args[0]
																		__lowercase       	=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:
																		__lowercase       	=self.feature_extractor(A__  ,       *A__  ,       sampling_rate=A__  ,       **A__)
											if text is not None:
																		__lowercase       	=self.tokenizer(A__  ,       **A__)

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

				def 				__lowerCamelCase     (							self  :  Any  ,       *_lowerCAmelCase  :  List[Any]  ,       **_lowerCAmelCase  :  List[str]):







											'''simple docstring'''

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

				def 				__lowerCamelCase     (							self  :  Union[str, Any]  ,       *_lowerCAmelCase  :  Union[str, Any]  ,       **_lowerCAmelCase  :  Tuple):







											'''simple docstring'''

											if self._in_target_context_manager:
																		return self.current_processor.pad(*A__  ,       **A__)

											__lowercase       	=kwargs.pop('input_features'  ,       A__)
											__lowercase       	=kwargs.pop('labels'  ,       A__)
											if len(A__) > 0:
																		__lowercase       	=args[0]
																		__lowercase       	=args[1:]

											if input_features is not None:
																		__lowercase       	=self.feature_extractor.pad(A__  ,       *A__  ,       **A__)
											if labels is not None:
																		__lowercase       	=self.tokenizer.pad(A__  ,       **A__)

											if labels is None:
																		return input_features
											elif input_features is None:
																		return labels
											else:
																		__lowercase       	=labels['input_ids']
																		return input_features

				def 				__lowerCamelCase     (							self  :  List[Any]  ,       *_lowerCAmelCase  :  List[str]  ,       **_lowerCAmelCase  :  List[str]):







											'''simple docstring'''

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

				@contextmanager
				def 				__lowerCamelCase     (							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.')
											__lowercase       	=True
											__lowercase       	=self.tokenizer
											yield
											__lowercase       	=self.feature_extractor
											__lowercase       	=False








'''simple docstring'''



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


lowerCamelCase	 =       {
    """configuration_mask2former""": [
        """MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """Mask2FormerConfig""",
    ],
}

try:
		if not is_vision_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowerCamelCase	 =       ["""Mask2FormerImageProcessor"""]

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowerCamelCase	 =       [
		    """MASK2FORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
		    """Mask2FormerForUniversalSegmentation""",
		    """Mask2FormerModel""",
		    """Mask2FormerPreTrainedModel""",
		]

if TYPE_CHECKING:
		from .configuration_maskaformer import MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, MaskaFormerConfig

		try:
				if not is_vision_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .image_processing_maskaformer import MaskaFormerImageProcessor

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_maskaformer import (
				    MASK2FORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
				    MaskaFormerForUniversalSegmentation,
				    MaskaFormerModel,
				    MaskaFormerPreTrainedModel,
				)


else:
		import sys

		lowerCamelCase	 =       _LazyModule(__name__, globals()["""__file__"""], _import_structure)



