






from ..models.whisper import WhisperForConditionalGeneration, WhisperProcessor
from .base import PipelineTool






class 						snake_case  (  UpperCAmelCase	):
    __magic_name__   					=					'''openai/whisper-base'''
    __magic_name__   					=					(
        '''This is a tool that transcribes an audio into text. It takes an input named `audio` and returns the '''
        '''transcribed text.'''
    )
    __magic_name__   					=					'''transcriber'''
    __magic_name__   					=					WhisperProcessor
    __magic_name__   					=					WhisperForConditionalGeneration

    __magic_name__   					=					['''audio''']
    __magic_name__   					=					['''text''']





    def     lowerCamelCase__				(							self     : List[Any]    ,		A     : Union[str, Any]      ):


      '''simple docstring'''




      return self.pre_processor(lowerCamelCase_    ,		return_tensors='pt'      ).input_features





    def     lowerCamelCase__				(							self     : int    ,		A     : Optional[int]      ):


      '''simple docstring'''




      return self.model.generate(inputs=lowerCamelCase_      )





    def     lowerCamelCase__				(							self     : Union[str, Any]    ,		A     : List[Any]      ):


      '''simple docstring'''




      return self.pre_processor.batch_decode(lowerCamelCase_    ,		skip_special_tokens=lowerCamelCase_      )[0]












"""simple docstring"""


from typing import TYPE_CHECKING

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


_UpperCamelCase    :   Optional[int]   			=						{
    'configuration_rag': ['RagConfig'],
    'retrieval_rag': ['RagRetriever'],
    'tokenization_rag': ['RagTokenizer'],
}

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _UpperCamelCase    :   Dict   			=						[
       'RagModel',
       'RagPreTrainedModel',
       'RagSequenceForGeneration',
       'RagTokenForGeneration',
   ]

try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _UpperCamelCase    :   Optional[int]   			=						[
       'TFRagModel',
       'TFRagPreTrainedModel',
       'TFRagSequenceForGeneration',
       'TFRagTokenForGeneration',
   ]


if TYPE_CHECKING:
   from .configuration_rag import RagConfig
   from .retrieval_rag import RagRetriever
   from .tokenization_rag import RagTokenizer

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_rag import RagModel, RagPreTrainedModel, RagSequenceForGeneration, RagTokenForGeneration

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_rag import (
          TFRagModel,
          TFRagPreTrainedModel,
          TFRagSequenceForGeneration,
          TFRagTokenForGeneration,
      )

else:
   import sys

   _UpperCamelCase    :   int   			=						_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)




