





from ...processing_utils import ProcessorMixin
class SCREAMING_SNAKE_CASE_  (    __snake_case    ):
						__magic_name__:	List[Any]       					=				"WhisperFeatureExtractor"
						__magic_name__:	Optional[int]       					=				"WhisperTokenizer"






						def __init__(					self					:					int						,      _A					:					Tuple						,      _A					:					Optional[int]		)							->			Optional[int]:







							"""simple docstring"""


							super().__init__(_A						,      _A		)
							snake_case_						:	List[Any]      =		self.feature_extractor
							snake_case_						:	Union[str, Any]      =		False






						def UpperCAmelCase_ (					self					:					List[str]						,      _A					:					Union[str, Any]=None						,      _A					:					List[Any]=None						,      _A					:					Any=True		)							->			Any:







							"""simple docstring"""


							return self.tokenizer.get_decoder_prompt_ids(task=_A						,      language=_A						,      no_timestamps=_A		)






						def __call__(					self					:					Optional[Any]						,      *_A					:					Any						,      **_A					:					Tuple		)							->			Optional[Any]:







							"""simple docstring"""


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

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

							if text is None:
								return inputs

							elif audio is None:
								return encodings
							else:
								snake_case_						:	List[str]      =		encodings['''input_ids''']
								return inputs






						def UpperCAmelCase_ (					self					:					Any						,      *_A					:					Tuple						,      **_A					:					List[str]		)							->			Optional[int]:







							"""simple docstring"""


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






						def UpperCAmelCase_ (					self					:					Any						,      *_A					:					List[Any]						,      **_A					:					Dict		)							->			str:







							"""simple docstring"""


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






						def UpperCAmelCase_ (					self					:					Optional[int]						,      _A					:					int						,      _A					:					Dict="np"		)							->			Dict:







							"""simple docstring"""


							return self.tokenizer.get_prompt_ids(_A						,      return_tensors=_A		)



'''simple docstring'''




from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_speech_available,
    is_tf_available,
    is_torch_available,
)


lowercase			:				Dict    		=			{
    'configuration_speech_to_text': ['SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Speech2TextConfig'],
    'processing_speech_to_text': ['Speech2TextProcessor'],
}

try:
      if not is_sentencepiece_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase			:				List[Any]    		=			['Speech2TextTokenizer']

try:
      if not is_speech_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase			:				List[str]    		=			['Speech2TextFeatureExtractor']

try:
      if not is_tf_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase			:				Dict    		=			[
          'TF_SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST',
          'TFSpeech2TextForConditionalGeneration',
          'TFSpeech2TextModel',
          'TFSpeech2TextPreTrainedModel',
      ]

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase			:				Any    		=			[
          'SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST',
          'Speech2TextForConditionalGeneration',
          'Speech2TextModel',
          'Speech2TextPreTrainedModel',
      ]


if TYPE_CHECKING:
      from .configuration_speech_to_text import SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP, SpeechaTextConfig
      from .processing_speech_to_text import SpeechaTextProcessor

      try:
            if not is_sentencepiece_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_speech_to_text import SpeechaTextTokenizer

      try:
            if not is_speech_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .feature_extraction_speech_to_text import SpeechaTextFeatureExtractor

      try:
            if not is_tf_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_tf_speech_to_text import (
                TF_SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST,
                TFSpeechaTextForConditionalGeneration,
                TFSpeechaTextModel,
                TFSpeechaTextPreTrainedModel,
            )

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_speech_to_text import (
                SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST,
                SpeechaTextForConditionalGeneration,
                SpeechaTextModel,
                SpeechaTextPreTrainedModel,
            )

else:
      import sys

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




