

from typing import List, Optional, Union

from ...image_utils import ImageInput
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType




class  _lowerCAmelCase  (     _lowercase       ):







 """simple docstring"""







 __UpperCAmelCase     : List[Any]       		=     ["image_processor", "tokenizer"]
 __UpperCAmelCase     : Any       		=     "BlipImageProcessor"
 __UpperCAmelCase     : List[Any]       		=     ("BertTokenizer", "BertTokenizerFast")


 def __init__(      self							:      Optional[Any], UpperCAmelCase__							:      List[str], UpperCAmelCase__							:      Optional[int]     ):
    __lowercase								=						False
    super().__init__(__UpperCamelCase, __UpperCamelCase     )
    __lowercase								=						self.image_processor


 def __call__(      self							:      Any, UpperCAmelCase__							:      ImageInput = None, UpperCAmelCase__							:      Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]] = None, UpperCAmelCase__							:      bool = True, UpperCAmelCase__							:      Union[bool, str, PaddingStrategy] = False, UpperCAmelCase__							:      Union[bool, str, TruncationStrategy] = None, UpperCAmelCase__							:      Optional[int] = None, UpperCAmelCase__							:      int = 0, UpperCAmelCase__							:      Optional[int] = None, UpperCAmelCase__							:      Optional[bool] = None, UpperCAmelCase__							:      bool = False, UpperCAmelCase__							:      bool = False, UpperCAmelCase__							:      bool = False, UpperCAmelCase__							:      bool = False, UpperCAmelCase__							:      bool = False, UpperCAmelCase__							:      bool = True, UpperCAmelCase__							:      Optional[Union[str, TensorType]] = None, **UpperCAmelCase__							:      List[str], ):
    if images is None and text is None:
       raise ValueError("You have to specify either images or text."     )

    # Get only text
    if images is None:
       __lowercase								=						self.tokenizer
       __lowercase								=						self.tokenizer(
           text=__UpperCamelCase, add_special_tokens=__UpperCamelCase, padding=__UpperCamelCase, truncation=__UpperCamelCase, max_length=__UpperCamelCase, stride=__UpperCamelCase, pad_to_multiple_of=__UpperCamelCase, return_attention_mask=__UpperCamelCase, return_overflowing_tokens=__UpperCamelCase, return_special_tokens_mask=__UpperCamelCase, return_offsets_mapping=__UpperCamelCase, return_token_type_ids=__UpperCamelCase, return_length=__UpperCamelCase, verbose=__UpperCamelCase, return_tensors=__UpperCamelCase, **__UpperCamelCase, )
       return text_encoding

    # add pixel_values
    __lowercase								=						self.image_processor(__UpperCamelCase, return_tensors=__UpperCamelCase     )

    if text is not None:
       __lowercase								=						self.tokenizer(
           text=__UpperCamelCase, add_special_tokens=__UpperCamelCase, padding=__UpperCamelCase, truncation=__UpperCamelCase, max_length=__UpperCamelCase, stride=__UpperCamelCase, pad_to_multiple_of=__UpperCamelCase, return_attention_mask=__UpperCamelCase, return_overflowing_tokens=__UpperCamelCase, return_special_tokens_mask=__UpperCamelCase, return_offsets_mapping=__UpperCamelCase, return_token_type_ids=__UpperCamelCase, return_length=__UpperCamelCase, verbose=__UpperCamelCase, return_tensors=__UpperCamelCase, **__UpperCamelCase, )
    else:
       __lowercase								=						None

    if text_encoding is not None:
       encoding_image_processor.update(__UpperCamelCase     )

    return encoding_image_processor


 def  _lowercase			(      self							:      Union[str, Any], *UpperCAmelCase__							:      str, **UpperCAmelCase__							:      Any     ):
    return self.tokenizer.batch_decode(*__UpperCamelCase, **__UpperCamelCase     )


 def  _lowercase			(      self							:      Optional[int], *UpperCAmelCase__							:      List[Any], **UpperCAmelCase__							:      str     ):
    return self.tokenizer.decode(*__UpperCamelCase, **__UpperCamelCase     )



 @property
 def  _lowercase			(      self							:      List[str]     ):
    __lowercase								=						self.tokenizer.model_input_names
    __lowercase								=						self.image_processor.model_input_names
    return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names     )     )







"""simple docstring"""





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


_a							=							logging.get_logger(__name__)

_a							=							{
    'MIT/ast-finetuned-audioset-10-10-0.4593': (
        'https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/config.json'
    ),
}




class  _lowerCAmelCase  (     lowercase       ):







 """simple docstring"""







 __UpperCAmelCase     : Any       		=     "audio-spectrogram-transformer"


 def __init__(      self							:      Optional[Any], UpperCAmelCase__							:      Dict=7_6_8, UpperCAmelCase__							:      Optional[Any]=1_2, UpperCAmelCase__							:      Optional[int]=1_2, UpperCAmelCase__							:      List[str]=3_0_7_2, UpperCAmelCase__							:      List[str]="gelu", UpperCAmelCase__							:      Dict=0.0, UpperCAmelCase__							:      str=0.0, UpperCAmelCase__							:      Any=0.02, UpperCAmelCase__							:      Any=1E-12, UpperCAmelCase__							:      Dict=1_6, UpperCAmelCase__							:      Optional[int]=True, UpperCAmelCase__							:      Union[str, Any]=1_0, UpperCAmelCase__							:      List[Any]=1_0, UpperCAmelCase__							:      Optional[int]=1_0_2_4, UpperCAmelCase__							:      List[str]=1_2_8, **UpperCAmelCase__							:      List[Any], ):
    super().__init__(**UpperCAmelCase__     )

    __lowercase								=						hidden_size
    __lowercase								=						num_hidden_layers
    __lowercase								=						num_attention_heads
    __lowercase								=						intermediate_size
    __lowercase								=						hidden_act
    __lowercase								=						hidden_dropout_prob
    __lowercase								=						attention_probs_dropout_prob
    __lowercase								=						initializer_range
    __lowercase								=						layer_norm_eps
    __lowercase								=						patch_size
    __lowercase								=						qkv_bias
    __lowercase								=						frequency_stride
    __lowercase								=						time_stride
    __lowercase								=						max_length
    __lowercase								=						num_mel_bins




