
from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


_snake_case      = logging.get_logger(__name__)

_snake_case      = {
    '''roberta-base''': '''https://huggingface.co/roberta-base/resolve/main/config.json''',
    '''roberta-large''': '''https://huggingface.co/roberta-large/resolve/main/config.json''',
    '''roberta-large-mnli''': '''https://huggingface.co/roberta-large-mnli/resolve/main/config.json''',
    '''distilroberta-base''': '''https://huggingface.co/distilroberta-base/resolve/main/config.json''',
    '''roberta-base-openai-detector''': '''https://huggingface.co/roberta-base-openai-detector/resolve/main/config.json''',
    '''roberta-large-openai-detector''': '''https://huggingface.co/roberta-large-openai-detector/resolve/main/config.json''',
}
class       _lowerCAmelCase  (		__magic_name__							):

 """simple docstring"""
 SCREAMING_SNAKE_CASE_				:					Dict       						="roberta"

 def __init__(						self			:			Union[str, Any]					, SCREAMING_SNAKE_CASE__			:			Tuple=5_02_65					, SCREAMING_SNAKE_CASE__			:			List[str]=7_68					, SCREAMING_SNAKE_CASE__			:			List[str]=12					, SCREAMING_SNAKE_CASE__			:			Any=12					, SCREAMING_SNAKE_CASE__			:			Tuple=30_72					, SCREAMING_SNAKE_CASE__			:			str="gelu"					, SCREAMING_SNAKE_CASE__			:			Union[str, Any]=0.1					, SCREAMING_SNAKE_CASE__			:			int=0.1					, SCREAMING_SNAKE_CASE__			:			int=5_12					, SCREAMING_SNAKE_CASE__			:			Optional[Any]=2					, SCREAMING_SNAKE_CASE__			:			Dict=0.02					, SCREAMING_SNAKE_CASE__			:			List[str]=1e-12					, SCREAMING_SNAKE_CASE__			:			Any=1					, SCREAMING_SNAKE_CASE__			:			Optional[Any]=0					, SCREAMING_SNAKE_CASE__			:			str=2					, SCREAMING_SNAKE_CASE__			:			Any="absolute"					, SCREAMING_SNAKE_CASE__			:			Any=True					, SCREAMING_SNAKE_CASE__			:			List[Any]=None					, **SCREAMING_SNAKE_CASE__			:			Optional[int]					, ):






      """simple docstring"""



      super().__init__(pad_token_id=SCREAMING_SNAKE_CASE__					, bos_token_id=SCREAMING_SNAKE_CASE__					, eos_token_id=SCREAMING_SNAKE_CASE__					, **SCREAMING_SNAKE_CASE__   )

      UpperCamelCase						    =					vocab_size
      UpperCamelCase						    =					hidden_size
      UpperCamelCase						    =					num_hidden_layers
      UpperCamelCase						    =					num_attention_heads
      UpperCamelCase						    =					hidden_act
      UpperCamelCase						    =					intermediate_size
      UpperCamelCase						    =					hidden_dropout_prob
      UpperCamelCase						    =					attention_probs_dropout_prob
      UpperCamelCase						    =					max_position_embeddings
      UpperCamelCase						    =					type_vocab_size
      UpperCamelCase						    =					initializer_range
      UpperCamelCase						    =					layer_norm_eps
      UpperCamelCase						    =					position_embedding_type
      UpperCamelCase						    =					use_cache
      UpperCamelCase						    =					classifier_dropout




class       _lowerCAmelCase  (		__magic_name__							):

 """simple docstring"""

 @property
 def      __lowerCAmelCase  (						self			:			Optional[int]   ):






      """simple docstring"""



      if self.task == "multiple-choice":
           UpperCamelCase						    =					{0: 'batch', 1: 'choice', 2: 'sequence'}
      else:
           UpperCamelCase						    =					{0: 'batch', 1: 'sequence'}
      return OrderedDict(
          [
              ('input_ids', dynamic_axis),
              ('attention_mask', dynamic_axis),
          ]   )




# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from ..models.whisper import WhisperForConditionalGeneration, WhisperProcessor
from .base import PipelineTool
class       _lowerCAmelCase  (		__magic_name__							):

 """simple docstring"""
 SCREAMING_SNAKE_CASE_				:					Tuple       						="openai/whisper-base"
 SCREAMING_SNAKE_CASE_				:					List[str]       						=(
     "This is a tool that transcribes an audio into text. It takes an input named `audio` and returns the "
     "transcribed text."
 )
 SCREAMING_SNAKE_CASE_				:					int       						="transcriber"
 SCREAMING_SNAKE_CASE_				:					Tuple       						=WhisperProcessor
 SCREAMING_SNAKE_CASE_				:					List[Any]       						=WhisperForConditionalGeneration

 SCREAMING_SNAKE_CASE_				:					Union[str, Any]       						=["audio"]
 SCREAMING_SNAKE_CASE_				:					Any       						=["text"]

 def      __lowerCAmelCase  (						self			:			List[Any]					, SCREAMING_SNAKE_CASE__			:			List[Any]   ):






      """simple docstring"""



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

 def      __lowerCAmelCase  (						self			:			Tuple					, SCREAMING_SNAKE_CASE__			:			Union[str, Any]   ):






      """simple docstring"""



      return self.model.generate(inputs=SCREAMING_SNAKE_CASE__   )






 def      __lowerCAmelCase  (						self			:			List[str]					, SCREAMING_SNAKE_CASE__			:			List[str]   ):






      """simple docstring"""



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


