



'''simple docstring'''





from typing import List

import datasets
from datasets.tasks import AudioClassification

from ..folder_based_builder import folder_based_builder


A__    :   List[Any]           =					datasets.utils.logging.get_logger(__name__)



class  snake_case__						(    folder_based_builder.FolderBasedBuilderConfig				):
 A__				= None
 A__				= None



class  snake_case__						(    folder_based_builder.FolderBasedBuilder				):
 A__				= datasets.Audio()
 A__				= '''audio'''
 A__				= AudioFolderConfig
 A__				= 42  # definition at the bottom of the script
 A__				= AudioClassification(audio_column='''audio'''  ,     label_column='''label'''				)



A__    :   Tuple           =					[
    '''.aiff''',
    '''.au''',
    '''.avr''',
    '''.caf''',
    '''.flac''',
    '''.htk''',
    '''.svx''',
    '''.mat4''',
    '''.mat5''',
    '''.mpc2k''',
    '''.ogg''',
    '''.paf''',
    '''.pvf''',
    '''.raw''',
    '''.rf64''',
    '''.sd2''',
    '''.sds''',
    '''.ircam''',
    '''.voc''',
    '''.w64''',
    '''.wav''',
    '''.nist''',
    '''.wavex''',
    '''.wve''',
    '''.xi''',
    '''.mp3''',
    '''.opus''',
]
A__    :   Union[str, Any]           =					AUDIO_EXTENSIONS








'''simple docstring'''





import warnings

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



class  snake_case__						(    SCREAMING_SNAKE_CASE_				):
 A__				= ['''image_processor''', '''tokenizer''']
 A__				= '''CLIPImageProcessor'''
 A__				= ('''CLIPTokenizer''', '''CLIPTokenizerFast''')
 def __init__(   self						:							Any      ,     __a						:							str=None      ,     __a						:							List[Any]=None      ,     **__a						:							List[str]  )      ->   Optional[Any]:







       '''simple docstring'''
       __snake_case :   Optional[Any]													=    None
       if "feature_extractor" in kwargs:
             warnings.warn(
                 'The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`'
                 ' instead.'      ,     __a      ,     )
             __snake_case :   List[str]													=    kwargs.pop('feature_extractor'  )

       __snake_case :   List[Any]													=    image_processor if image_processor is not None else feature_extractor
       if image_processor is None:
             raise ValueError('You need to specify an `image_processor`.'  )
       if tokenizer is None:
             raise ValueError('You need to specify a `tokenizer`.'  )

       super().__init__(__a      ,     __a  )
 def __call__(   self						:							List[Any]      ,     __a						:							Optional[int]=None      ,     __a						:							Optional[int]=None      ,     __a						:							Union[str, Any]=None      ,     **__a						:							Union[str, Any]  )      ->   List[Any]:







       '''simple docstring'''

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

       if text is not None:
             __snake_case :   Any													=    self.tokenizer(__a      ,     return_tensors=__a      ,     **__a  )

       if images is not None:
             __snake_case :   str													=    self.image_processor(__a      ,     return_tensors=__a      ,     **__a  )

       if text is not None and images is not None:
             __snake_case :   Optional[Any]													=    image_features.pixel_values
             return encoding
       elif text is not None:
             return encoding
       else:
             return BatchEncoding(data=dict(**__a  )      ,     tensor_type=__a  )
 def A_   (   self						:							List[Any]      ,     *__a						:							Dict      ,     **__a						:							Dict  )      ->   Union[str, Any]:







       '''simple docstring'''
       return self.tokenizer.batch_decode(*__a      ,     **__a  )
 def A_   (   self						:							str      ,     *__a						:							Tuple      ,     **__a						:							List[str]  )      ->   int:







       '''simple docstring'''
       return self.tokenizer.decode(*__a      ,     **__a  )
 @property
 def A_   (   self						:							Union[str, Any]  )      ->   Optional[Any]:







       '''simple docstring'''
       __snake_case :   Tuple													=    self.tokenizer.model_input_names
       __snake_case :   Tuple													=    self.image_processor.model_input_names
       return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names  )  )
 @property
 def A_   (   self						:							Any  )      ->   Any:







       '''simple docstring'''
       warnings.warn(
           '`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.'      ,     __a      ,     )
       return self.image_processor_class





 @property
 def A_   (   self						:							Optional[int]  )      ->   Optional[Any]:







       '''simple docstring'''
       warnings.warn(
           '`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.'      ,     __a      ,     )
       return self.image_processor



