




"""simple docstring"""




from ...processing_utils import ProcessorMixin

class   UpperCAmelCase_    (			snake_case		):
		UpperCamelCase							="WhisperFeatureExtractor"
		UpperCamelCase							="WhisperTokenizer"
		def __init__(						self				,						UpperCamelCase_				,						UpperCamelCase_       )						->       Dict:
					super().__init__(UpperCamelCase_				,						UpperCamelCase_       )
					__lowercase			:  Union[str, Any]								=       self.feature_extractor
					__lowercase			:  Tuple								=       False
		def 	_lowerCamelCase							(						self				,						UpperCamelCase_=None				,						UpperCamelCase_=None				,						UpperCamelCase_=True       )						->       Any:
					return self.tokenizer.get_decoder_prompt_ids(task=UpperCamelCase_				,						language=UpperCamelCase_				,						no_timestamps=UpperCamelCase_       )
		def __call__(						self				,						*UpperCamelCase_				,						**UpperCamelCase_       )						->       Optional[int]:
					# For backward compatibility
					if self._in_target_context_manager:
								return self.current_processor(*UpperCamelCase_				,						**UpperCamelCase_       )

					__lowercase			:  Optional[int]								=       kwargs.pop('''audio'''				,						UpperCamelCase_       )
					__lowercase			:  Optional[Any]								=       kwargs.pop('''sampling_rate'''				,						UpperCamelCase_       )
					__lowercase			:  str								=       kwargs.pop('''text'''				,						UpperCamelCase_       )
					if len(UpperCamelCase_       ) > 0:
								__lowercase			:  Union[str, Any]								=       args[0]
								__lowercase			:  List[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:
								__lowercase			:  Tuple								=       self.feature_extractor(UpperCamelCase_				,						*UpperCamelCase_				,						sampling_rate=UpperCamelCase_				,						**UpperCamelCase_       )
					if text is not None:
								__lowercase			:  List[Any]								=       self.tokenizer(UpperCamelCase_				,						**UpperCamelCase_       )

					if text is None:
								return inputs

					elif audio is None:
								return encodings
					else:
								__lowercase			:  int								=       encodings['''input_ids''']
								return inputs
		def 	_lowerCamelCase							(						self				,						*UpperCamelCase_				,						**UpperCamelCase_       )						->       List[Any]:
					return self.tokenizer.batch_decode(*UpperCamelCase_				,						**UpperCamelCase_       )
		def 	_lowerCamelCase							(						self				,						*UpperCamelCase_				,						**UpperCamelCase_       )						->       List[Any]:
					return self.tokenizer.decode(*UpperCamelCase_				,						**UpperCamelCase_       )
		def 	_lowerCamelCase							(						self				,						UpperCamelCase_				,						UpperCamelCase_="np"       )						->       int:
					return self.tokenizer.get_prompt_ids(UpperCamelCase_				,						return_tensors=UpperCamelCase_       )








from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


a      :  Dict			     =			{
    'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertConfig'],
    'tokenization_lxmert': ['LxmertTokenizer'],
}

try:
	if not is_tokenizers_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	a      :  Any			     =			['LxmertTokenizerFast']

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	a      :  str			     =			[
	    'LxmertEncoder',
	    'LxmertForPreTraining',
	    'LxmertForQuestionAnswering',
	    'LxmertModel',
	    'LxmertPreTrainedModel',
	    'LxmertVisualFeatureEncoder',
	    'LxmertXLayer',
	]

try:
	if not is_tf_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	a      :  str			     =			[
	    'TF_LXMERT_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'TFLxmertForPreTraining',
	    'TFLxmertMainLayer',
	    'TFLxmertModel',
	    'TFLxmertPreTrainedModel',
	    'TFLxmertVisualFeatureEncoder',
	]


if TYPE_CHECKING:
	from .configuration_lxmert import LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP, LxmertConfig
	from .tokenization_lxmert import LxmertTokenizer

	try:
		if not is_tokenizers_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .tokenization_lxmert_fast import LxmertTokenizerFast

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_lxmert import (
		    LxmertEncoder,
		    LxmertForPreTraining,
		    LxmertForQuestionAnswering,
		    LxmertModel,
		    LxmertPreTrainedModel,
		    LxmertVisualFeatureEncoder,
		    LxmertXLayer,
		)

	try:
		if not is_tf_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_tf_lxmert import (
		    TF_LXMERT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    TFLxmertForPreTraining,
		    TFLxmertMainLayer,
		    TFLxmertModel,
		    TFLxmertPreTrainedModel,
		    TFLxmertVisualFeatureEncoder,
		)

else:
	import sys

	a      :  str			     =			_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)






