




'''simple docstring'''





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




class 			_snake_case		(     lowercase_							):
   lowerCAmelCase_					:				Tuple							=   "openai/whisper-base"
   lowerCAmelCase_					:				Optional[Any]							=   (
       "This is a tool that transcribes an audio into text. It takes an input named `audio` and returns the "
       "transcribed text."
   )
   lowerCAmelCase_					:				Tuple							=   "transcriber"
   lowerCAmelCase_					:				str							=   WhisperProcessor
   lowerCAmelCase_					:				Any							=   WhisperForConditionalGeneration

   lowerCAmelCase_					:				Optional[int]							=   ["audio"]
   lowerCAmelCase_					:				Optional[Any]							=   ["text"]




   def        lowerCAmelCase__    ( self    ,							a__							)    ->    Optional[int]:

          '''simple docstring'''




          return self.pre_processor(a__    ,							return_tensors="pt"							).input_features




   def        lowerCAmelCase__    ( self    ,							a__							)    ->    str:

          '''simple docstring'''




          return self.model.generate(inputs=a__							)




   def        lowerCAmelCase__    ( self    ,							a__							)    ->    int:

          '''simple docstring'''




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










'''simple docstring'''





from ...configuration_utils import PretrainedConfig
from ...utils import logging


_SCREAMING_SNAKE_CASE							:       Any						=			logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE							:       int						=			{
    "alibaba-damo/mgp-str-base": "https://huggingface.co/alibaba-damo/mgp-str-base/resolve/main/config.json",
}




class 			_snake_case		(     lowercase_							):
			lowerCAmelCase_					:				Union[str, Any]							=   "mgp-str"




			def __init__( self    ,							a__=[32, 128]    ,							a__=4    ,							a__=3    ,							a__=27    ,							a__=38    ,							a__=50_257    ,							a__=30_522    ,							a__=768    ,							a__=12    ,							a__=12    ,							a__=4.0    ,							a__=True    ,							a__=False    ,							a__=1e-5    ,							a__=0.0    ,							a__=0.0    ,							a__=0.0    ,							a__=False    ,							a__=0.0_2    ,							**a__    ,							)    ->    Union[str, Any]:

										'''simple docstring'''




										super().__init__(**a__							)

										snake_case_      =				image_size
										snake_case_      =				patch_size
										snake_case_      =				num_channels
										snake_case_      =				max_token_length
										snake_case_      =				num_character_labels
										snake_case_      =				num_bpe_labels
										snake_case_      =				num_wordpiece_labels
										snake_case_      =				hidden_size
										snake_case_      =				num_hidden_layers
										snake_case_      =				num_attention_heads
										snake_case_      =				mlp_ratio
										snake_case_      =				distilled
										snake_case_      =				layer_norm_eps
										snake_case_      =				drop_rate
										snake_case_      =				qkv_bias
										snake_case_      =				attn_drop_rate
										snake_case_      =				drop_path_rate
										snake_case_      =				output_aa_attentions
										snake_case_      =				initializer_range




