



'''simple docstring'''






from ...processing_utils import ProcessorMixin



class 							lowercase       (  _lowerCamelCase				):


 """simple docstring"""


 UpperCAmelCase							=  """WhisperFeatureExtractor"""
 UpperCAmelCase							=  """WhisperTokenizer"""







 def __init__(							self  ,a_  ,a_							)		->   int:
        super().__init__(a_  ,a_							)
        _UpperCAmelCase  :						Optional[Any]			     = self.feature_extractor
        _UpperCAmelCase  :						Optional[int]			     = False







 def _snake_case (							self  ,a_=None  ,a_=None  ,a_=True							)		->   int:
        return self.tokenizer.get_decoder_prompt_ids(task=a_  ,language=a_  ,no_timestamps=a_							)







 def __call__(							self  ,*a_  ,**a_							)		->   Optional[int]:
        # For backward compatibility
        if self._in_target_context_manager:
               return self.current_processor(*a_  ,**a_							)

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

        if text is None:
               return inputs

        elif audio is None:
               return encodings
        else:
               _UpperCAmelCase  :						Optional[int]			     = encodings["""input_ids"""]
               return inputs







 def _snake_case (							self  ,*a_  ,**a_							)		->   List[str]:
        return self.tokenizer.batch_decode(*a_  ,**a_							)







 def _snake_case (							self  ,*a_  ,**a_							)		->   Any:
        return self.tokenizer.decode(*a_  ,**a_							)







 def _snake_case (							self  ,a_  ,a_="np"							)		->   str:
        return self.tokenizer.get_prompt_ids(a_  ,return_tensors=a_							)








'''simple docstring'''






from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_tokenizers_available,
    is_torch_available,
)


A_							: Optional[Any]						 =	{
    """configuration_llama""": ["""LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LlamaConfig"""],
}

try:
   if not is_sentencepiece_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   A_							: List[str]						 =	["""LlamaTokenizer"""]

try:
   if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   A_							: Dict						 =	["""LlamaTokenizerFast"""]

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   A_							: Optional[int]						 =	[
       """LlamaForCausalLM""",
       """LlamaModel""",
       """LlamaPreTrainedModel""",
       """LlamaForSequenceClassification""",
   ]


if TYPE_CHECKING:
   from .configuration_llama import LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP, LlamaConfig

   try:
      if not is_sentencepiece_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_llama import LlamaTokenizer

   try:
      if not is_tokenizers_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_llama_fast import LlamaTokenizerFast

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_llama import LlamaForCausalLM, LlamaForSequenceClassification, LlamaModel, LlamaPreTrainedModel


else:
   import sys

   A_							: Any						 =	_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



