
from ...processing_utils import ProcessorMixin







class   lowerCamelCase	(						A_						):
     UpperCAmelCase__       :							Optional[int]     =	"WhisperFeatureExtractor"
     UpperCAmelCase__       :							List[Any]     =	"WhisperTokenizer"





     def __init__(self   :					Union[str, Any]       ,					_A   :					Any       ,					_A   :					str     )		->		Optional[int]:
         super().__init__(_A       ,					_A     )
         snake_case				  =      self.feature_extractor
         snake_case				  =      False





     def 	UpperCAmelCase(self   :					Union[str, Any]       ,					_A   :					Optional[int]=None       ,					_A   :					Tuple=None       ,					_A   :					List[str]=True     )		->		Tuple:
         return self.tokenizer.get_decoder_prompt_ids(task=_A       ,					language=_A       ,					no_timestamps=_A     )





     def __call__(self   :					Dict       ,					*_A   :					List[Any]       ,					**_A   :					int     )		->		List[str]:
         # For backward compatibility
         if self._in_target_context_manager:
             return self.current_processor(*_A       ,					**_A     )

         snake_case				  =      kwargs.pop("audio"       ,					_A     )
         snake_case				  =      kwargs.pop("sampling_rate"       ,					_A     )
         snake_case				  =      kwargs.pop("text"       ,					_A     )
         if len(_A     ) > 0:
             snake_case				  =      args[0]
             snake_case				  =      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				  =      self.feature_extractor(_A       ,					*_A       ,					sampling_rate=_A       ,					**_A     )
         if text is not None:
             snake_case				  =      self.tokenizer(_A       ,					**_A     )

         if text is None:
             return inputs

         elif audio is None:
             return encodings
         else:
             snake_case				  =      encodings["input_ids"]
             return inputs





     def 	UpperCAmelCase(self   :					str       ,					*_A   :					List[Any]       ,					**_A   :					List[Any]     )		->		Dict:
         return self.tokenizer.batch_decode(*_A       ,					**_A     )





     def 	UpperCAmelCase(self   :					Union[str, Any]       ,					*_A   :					Optional[int]       ,					**_A   :					Tuple     )		->		Optional[Any]:
         return self.tokenizer.decode(*_A       ,					**_A     )





     def 	UpperCAmelCase(self   :					Tuple       ,					_A   :					str       ,					_A   :					List[str]="np"     )		->		Any:
         return self.tokenizer.get_prompt_ids(_A       ,					return_tensors=_A     )



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


_A						      =				logging.get_logger(__name__)

_A						      =				{
    "google/canine-s": "https://huggingface.co/google/canine-s/resolve/main/config.json",
    # See all CANINE models at https://huggingface.co/models?filter=canine
}







class   lowerCamelCase	(						A_						):
     UpperCAmelCase__       :							Dict     =	"canine"





     def __init__(self   :					List[Any]       ,					_A   :					Union[str, Any]=7_6_8       ,					_A   :					Any=1_2       ,					_A   :					List[Any]=1_2       ,					_A   :					List[Any]=3_0_7_2       ,					_A   :					Dict="gelu"       ,					_A   :					Optional[Any]=0.1       ,					_A   :					Tuple=0.1       ,					_A   :					str=1_6_3_8_4       ,					_A   :					Union[str, Any]=1_6       ,					_A   :					Any=0.02       ,					_A   :					List[str]=1E-12       ,					_A   :					Union[str, Any]=0       ,					_A   :					Dict=0Xe0_00       ,					_A   :					List[Any]=0Xe0_01       ,					_A   :					int=4       ,					_A   :					str=4       ,					_A   :					Optional[int]=8       ,					_A   :					Optional[Any]=1_6_3_8_4       ,					_A   :					Optional[Any]=1_2_8       ,					**_A   :					Union[str, Any]       ,					)		->		Union[str, Any]:
         super().__init__(pad_token_id=_A       ,					bos_token_id=_A       ,					eos_token_id=_A       ,					**_A     )

         snake_case				  =      max_position_embeddings
         snake_case				  =      hidden_size
         snake_case				  =      num_hidden_layers
         snake_case				  =      num_attention_heads
         snake_case				  =      intermediate_size
         snake_case				  =      hidden_act
         snake_case				  =      hidden_dropout_prob
         snake_case				  =      attention_probs_dropout_prob
         snake_case				  =      initializer_range
         snake_case				  =      type_vocab_size
         snake_case				  =      layer_norm_eps

         # Character config:
         snake_case				  =      downsampling_rate
         snake_case				  =      upsampling_kernel_size
         snake_case				  =      num_hash_functions
         snake_case				  =      num_hash_buckets
         snake_case				  =      local_transformer_stride

