






"""simple docstring"""






from ...processing_utils import ProcessorMixin




class 							lowerCAmelCase__				(			UpperCAmelCase__ ):






      '''simple docstring'''

      __UpperCamelCase	 =  "WhisperFeatureExtractor"
      __UpperCamelCase	 =  "WhisperTokenizer"
      def __init__(						self     :  List[str]						,	lowercase_     :  List[Any]						,	lowercase_     :  Dict):




          '''simple docstring'''


          super().__init__(lowercase_						,	lowercase_)
          SCREAMING_SNAKE_CASE_      :  Optional[Any]    						=		self.feature_extractor
          SCREAMING_SNAKE_CASE_      :  Dict    						=		False
      def _SCREAMING_SNAKE_CASE (						self     :  int						,	lowercase_     :  str=None						,	lowercase_     :  Optional[Any]=None						,	lowercase_     :  Any=True):




          '''simple docstring'''


          return self.tokenizer.get_decoder_prompt_ids(task=lowercase_						,	language=lowercase_						,	no_timestamps=lowercase_)
      def __call__(						self     :  Dict						,	*lowercase_     :  Dict						,	**lowercase_     :  Union[str, Any]):




          '''simple docstring'''


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

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

          if text is None:
              return inputs

          elif audio is None:
              return encodings
          else:
              SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		encodings['''input_ids''']
              return inputs
      def _SCREAMING_SNAKE_CASE (						self     :  List[str]						,	*lowercase_     :  Optional[Any]						,	**lowercase_     :  Tuple):




          '''simple docstring'''


          return self.tokenizer.batch_decode(*lowercase_						,	**lowercase_)
      def _SCREAMING_SNAKE_CASE (						self     :  Optional[int]						,	*lowercase_     :  Dict						,	**lowercase_     :  Optional[Any]):




          '''simple docstring'''


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



      def _SCREAMING_SNAKE_CASE (						self     :  Dict						,	lowercase_     :  str						,	lowercase_     :  Optional[Any]="np"):




          '''simple docstring'''


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










"""simple docstring"""






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


UpperCAmelCase_   : Optional[int]   			= logging.get_logger(__name__)

UpperCAmelCase_   : Any   			= {"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/config.json"""}




class 							lowerCAmelCase__				(			UpperCAmelCase__ ):






      '''simple docstring'''

      __UpperCamelCase	 =  "openai-gpt"
      __UpperCamelCase	 =  {
          "max_position_embeddings": "n_positions",
          "hidden_size": "n_embd",
          "num_attention_heads": "n_head",
          "num_hidden_layers": "n_layer",
      }
      def __init__(						self     :  List[str]						,	lowercase_     :  List[str]=40478						,	lowercase_     :  List[str]=512						,	lowercase_     :  Optional[Any]=768						,	lowercase_     :  Tuple=12						,	lowercase_     :  Tuple=12						,	lowercase_     :  Union[str, Any]="gelu"						,	lowercase_     :  List[Any]=0.1						,	lowercase_     :  Tuple=0.1						,	lowercase_     :  List[Any]=0.1						,	lowercase_     :  List[Any]=1e-5						,	lowercase_     :  int=0.02						,	lowercase_     :  Optional[int]="cls_index"						,	lowercase_     :  Any=True						,	lowercase_     :  List[Any]=None						,	lowercase_     :  List[str]=True						,	lowercase_     :  Optional[Any]=0.1						,	**lowercase_     :  List[str]						,	):




          '''simple docstring'''


          SCREAMING_SNAKE_CASE_      :  Optional[int]    						=		vocab_size
          SCREAMING_SNAKE_CASE_      :  Tuple    						=		n_positions
          SCREAMING_SNAKE_CASE_      :  Optional[int]    						=		n_embd
          SCREAMING_SNAKE_CASE_      :  Dict    						=		n_layer
          SCREAMING_SNAKE_CASE_      :  Any    						=		n_head
          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		afn
          SCREAMING_SNAKE_CASE_      :  int    						=		resid_pdrop
          SCREAMING_SNAKE_CASE_      :  List[str]    						=		embd_pdrop
          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		attn_pdrop
          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		layer_norm_epsilon
          SCREAMING_SNAKE_CASE_      :  List[Any]    						=		initializer_range
          SCREAMING_SNAKE_CASE_      :  List[str]    						=		summary_type
          SCREAMING_SNAKE_CASE_      :  Tuple    						=		summary_use_proj
          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		summary_activation
          SCREAMING_SNAKE_CASE_      :  Any    						=		summary_first_dropout
          SCREAMING_SNAKE_CASE_      :  List[str]    						=		summary_proj_to_labels
          super().__init__(**lowercase_)


