

'''simple docstring'''







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available


__lowerCamelCase		       =    {
    '''configuration_audio_spectrogram_transformer''': [
        '''AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''ASTConfig''',
    ]
}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __lowerCamelCase		       =    [
          '''AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
          '''ASTForAudioClassification''',
          '''ASTModel''',
          '''ASTPreTrainedModel''',
      ]

try:
      if not is_speech_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __lowerCamelCase		       =    ['''ASTFeatureExtractor''']

if TYPE_CHECKING:
      from .configuration_audio_spectrogram_transformer import (
          AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
          ASTConfig,
      )

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_audio_spectrogram_transformer import (
                AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
                ASTForAudioClassification,
                ASTModel,
                ASTPreTrainedModel,
            )

      try:
            if not is_speech_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .feature_extraction_audio_spectrogram_transformer import ASTFeatureExtractor


else:
      import sys

      __lowerCamelCase		       =    _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)



'''simple docstring'''







from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding


class 					A__      (      _snake_case			):
    lowercase						=		"ClapFeatureExtractor"
    lowercase						=		("RobertaTokenizer", "RobertaTokenizerFast")



    def __init__(					self		,				UpperCamelCase__		,				UpperCamelCase__       )						->      Tuple:





           '''simple docstring'''
           super().__init__(UpperCamelCase__		,				UpperCamelCase__       )



    def __call__(					self		,				UpperCamelCase__=None		,				UpperCamelCase__=None		,				UpperCamelCase__=None		,				**UpperCamelCase__       )						->      Tuple:





           '''simple docstring'''
           A_						=      kwargs.pop("""sampling_rate"""		,				UpperCamelCase__       )

           if text is None and audios is None:
                  raise ValueError("""You have to specify either text or audios. Both cannot be none."""       )

           if text is not None:
                  A_						=      self.tokenizer(UpperCamelCase__		,				return_tensors=UpperCamelCase__		,				**UpperCamelCase__       )

           if audios is not None:
                  A_						=      self.feature_extractor(
                      UpperCamelCase__		,				sampling_rate=UpperCamelCase__		,				return_tensors=UpperCamelCase__		,				**UpperCamelCase__       )

           if text is not None and audios is not None:
                  A_						=      audio_features.input_features
                  return encoding
           elif text is not None:
                  return encoding
           else:
                  return BatchEncoding(data=dict(**UpperCamelCase__       )		,				tensor_type=UpperCamelCase__       )



    def 					snake_case_			(					self		,				*UpperCamelCase__		,				**UpperCamelCase__       )						->      Optional[int]:





           '''simple docstring'''
           return self.tokenizer.batch_decode(*UpperCamelCase__		,				**UpperCamelCase__       )



    def 					snake_case_			(					self		,				*UpperCamelCase__		,				**UpperCamelCase__       )						->      str:





           '''simple docstring'''
           return self.tokenizer.decode(*UpperCamelCase__		,				**UpperCamelCase__       )







    @property
    def 					snake_case_			(					self       )						->      int:





           '''simple docstring'''
           A_						=      self.tokenizer.model_input_names
           A_						=      self.feature_extractor.model_input_names
           return list(dict.fromkeys(tokenizer_input_names + feature_extractor_input_names       )       )
