

import copy
import os
from typing import Union

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


lowercase_   							=  logging.get_logger(__name__)

lowercase_   							=  {
    'BridgeTower/bridgetower-base': 'https://huggingface.co/BridgeTower/bridgetower-base/blob/main/config.json',
    'BridgeTower/bridgetower-base-itm-mlm': (
        'https://huggingface.co/BridgeTower/bridgetower-base-itm-mlm/blob/main/config.json'
    ),
}





class 					__lowerCAmelCase	(   SCREAMING_SNAKE_CASE				):
  _a		     =    """bridgetower_vision_model"""




  def __init__(							self				,  lowerCAmelCase=768				,  lowerCAmelCase=12				,  lowerCAmelCase=3				,  lowerCAmelCase=16				,  lowerCAmelCase=288				,  lowerCAmelCase=1				,  lowerCAmelCase=1e-05				,  lowerCAmelCase=False				,  lowerCAmelCase=True				,  lowerCAmelCase=False				,  **lowerCAmelCase				,  )    ->					Union[str, Any]:
        '''simple docstring'''






        super().__init__(**lowerCAmelCase   )
        _lowercase      			=hidden_size
        _lowercase      			=num_hidden_layers
        _lowercase      			=num_channels
        _lowercase      			=patch_size
        _lowercase      			=image_size
        _lowercase      			=initializer_factor
        _lowercase      			=layer_norm_eps
        _lowercase      			=stop_gradient
        _lowercase      			=share_layernorm
        _lowercase      			=remove_last_layer




  @classmethod
  def     A__	(							cls				,  lowerCAmelCase				,  **lowerCAmelCase   )    ->					"PretrainedConfig":
        '''simple docstring'''






        _lowercase			,			_lowercase      			=cls.get_config_dict(lowerCAmelCase				,  **lowerCAmelCase   )

        if config_dict.get('model_type'   ) == "bridgetower":
              _lowercase      			=config_dict['text_config']

        if "model_type" in config_dict and hasattr(cls				,  'model_type'   ) and config_dict["model_type"] != cls.model_type:
              logger.warning(
                  F'''You are using a model of type {config_dict["model_type"]} to instantiate a model of type '''
                  F'''{cls.model_type}. This is not supported for all configurations of models and can yield errors.'''   )

        return cls.from_dict(lowerCAmelCase				,  **lowerCAmelCase   )





class 					__lowerCAmelCase	(   SCREAMING_SNAKE_CASE				):
  _a		     =    """bridgetower_text_model"""




  def __init__(							self				,  lowerCAmelCase=50_265				,  lowerCAmelCase=768				,  lowerCAmelCase=12				,  lowerCAmelCase=12				,  lowerCAmelCase=1				,  lowerCAmelCase=3_072				,  lowerCAmelCase="gelu"				,  lowerCAmelCase=0.1				,  lowerCAmelCase=0.1				,  lowerCAmelCase=514				,  lowerCAmelCase=1				,  lowerCAmelCase=1e-05				,  lowerCAmelCase=1				,  lowerCAmelCase=0				,  lowerCAmelCase=2				,  lowerCAmelCase="absolute"				,  lowerCAmelCase=True				,  **lowerCAmelCase				,  )    ->					Optional[Any]:
        '''simple docstring'''






        super().__init__(**lowerCAmelCase   )

        _lowercase      			=vocab_size
        _lowercase      			=hidden_size
        _lowercase      			=num_hidden_layers
        _lowercase      			=num_attention_heads
        _lowercase      			=hidden_act
        _lowercase      			=initializer_factor
        _lowercase      			=intermediate_size
        _lowercase      			=hidden_dropout_prob
        _lowercase      			=attention_probs_dropout_prob
        _lowercase      			=max_position_embeddings
        _lowercase      			=type_vocab_size
        _lowercase      			=layer_norm_eps
        _lowercase      			=position_embedding_type
        _lowercase      			=use_cache
        _lowercase      			=pad_token_id
        _lowercase      			=bos_token_id
        _lowercase      			=eos_token_id




  @classmethod
  def     A__	(							cls				,  lowerCAmelCase				,  **lowerCAmelCase   )    ->					"PretrainedConfig":
        '''simple docstring'''






        _lowercase			,			_lowercase      			=cls.get_config_dict(lowerCAmelCase				,  **lowerCAmelCase   )

        if config_dict.get('model_type'   ) == "bridgetower":
              _lowercase      			=config_dict['text_config']

        if "model_type" in config_dict and hasattr(cls				,  'model_type'   ) and config_dict["model_type"] != cls.model_type:
              logger.warning(
                  F'''You are using a model of type {config_dict["model_type"]} to instantiate a model of type '''
                  F'''{cls.model_type}. This is not supported for all configurations of models and can yield errors.'''   )

        return cls.from_dict(lowerCAmelCase				,  **lowerCAmelCase   )





class 					__lowerCAmelCase	(   SCREAMING_SNAKE_CASE				):
  _a		     =    """bridgetower"""




  def __init__(							self				,  lowerCAmelCase=True				,  lowerCAmelCase="gelu"				,  lowerCAmelCase=768				,  lowerCAmelCase=1				,  lowerCAmelCase=1e-05				,  lowerCAmelCase=False				,  lowerCAmelCase="add"				,  lowerCAmelCase=12				,  lowerCAmelCase=6				,  lowerCAmelCase=False				,  lowerCAmelCase=False				,  lowerCAmelCase=None				,  lowerCAmelCase=None				,  **lowerCAmelCase				,  )    ->					Union[str, Any]:
        '''simple docstring'''






        _lowercase      			=kwargs.pop('text_config_dict'				,  lowerCAmelCase   )
        _lowercase      			=kwargs.pop('vision_config_dict'				,  lowerCAmelCase   )

        super().__init__(**lowerCAmelCase   )
        _lowercase      			=share_cross_modal_transformer_layers
        _lowercase      			=hidden_act
        _lowercase      			=hidden_size
        _lowercase      			=initializer_factor
        _lowercase      			=layer_norm_eps
        _lowercase      			=share_link_tower_layers
        _lowercase      			=link_tower_type
        _lowercase      			=num_attention_heads
        _lowercase      			=num_hidden_layers
        _lowercase      			=tie_word_embeddings
        _lowercase      			=init_layernorm_from_vision_encoder

        if text_config is None:
              _lowercase      			={}
              logger.info('`text_config` is `None`. Initializing the `BridgeTowerTextConfig` with default values.'   )

        if vision_config is None:
              _lowercase      			={}
              logger.info('`vision_config` is `None`. Initializing the `BridgeTowerVisionConfig` with default values.'   )

        _lowercase      			=BridgeTowerTextConfig(**lowerCAmelCase   )
        _lowercase      			=BridgeTowerVisionConfig(**lowerCAmelCase   )




  @classmethod
  def     A__	(							cls				,  lowerCAmelCase				,  lowerCAmelCase				,  **lowerCAmelCase   )    ->					List[str]:
        '''simple docstring'''






        return cls(text_config=text_config.to_dict()				,  vision_config=vision_config.to_dict()				,  **lowerCAmelCase   )




  def     A__	(							self   )    ->					Dict:
        '''simple docstring'''






        _lowercase      			=copy.deepcopy(self.__dict__   )
        _lowercase      			=self.text_config.to_dict()
        _lowercase      			=self.vision_config.to_dict()
        _lowercase      			=self.__class__.model_type
        return output





from typing import List

import datasets
from datasets.tasks import AudioClassification

from ..folder_based_builder import folder_based_builder


lowercase_   							=  datasets.utils.logging.get_logger(__name__)





class 					__lowerCAmelCase	(   folder_based_builder.FolderBasedBuilderConfig				):
  _a		     =    None
  _a		     =    None





class 					__lowerCAmelCase	(   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"""				)
lowercase_   							=  [
    '.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',
]
lowercase_   							=  AUDIO_EXTENSIONS


