


from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional, Union

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast
from ...utils import logging


if TYPE_CHECKING:
     from ...feature_extraction_utils import FeatureExtractionMixin
     from ...tokenization_utils_base import PreTrainedTokenizerBase
     from ...utils import TensorType

snake_case							:       str										=	logging.get_logger(__name__)

snake_case							:       Optional[int]										=	{
    '''openai/whisper-base''': '''https://huggingface.co/openai/whisper-base/resolve/main/config.json''',
}

# fmt: off
snake_case							:       int										=	[
    1, 2, 7, 8, 9, 10, 14, 25,
    26, 27, 28, 29, 31, 58, 59, 60, 61, 62,
    63, 90, 91, 92, 93, 3_57, 3_66, 4_38, 5_32, 6_85,
    7_05, 7_96, 9_30, 10_58, 12_20, 12_67, 12_79, 13_03, 13_43, 13_77,
    13_91, 16_35, 17_82, 18_75, 21_62, 23_61, 24_88, 34_67, 40_08, 42_11,
    46_00, 48_08, 52_99, 58_55, 63_29, 72_03, 96_09, 99_59, 1_05_63, 1_07_86,
    1_14_20, 1_17_09, 1_19_07, 1_31_63, 1_36_97, 1_37_00, 1_48_08, 1_53_06, 1_64_10, 1_67_91,
    1_79_92, 1_92_03, 1_95_10, 2_07_24, 2_23_05, 2_29_35, 2_70_07, 3_01_09, 3_04_20, 3_34_09,
    3_49_49, 4_02_83, 4_04_93, 4_05_49, 4_72_82, 4_91_46, 5_02_57, 5_03_59, 5_03_60, 5_03_61
]
snake_case							:       str										=	[
    1, 2, 7, 8, 9, 10, 14, 25,
    26, 27, 28, 29, 31, 58, 59, 60, 61, 62,
    63, 90, 91, 92, 93, 3_59, 5_03, 5_22, 5_42, 8_73,
    8_93, 9_02, 9_18, 9_22, 9_31, 13_50, 18_53, 19_82, 24_60, 26_27,
    32_46, 32_53, 32_68, 35_36, 38_46, 39_61, 41_83, 46_67, 65_85, 66_47,
    72_73, 90_61, 93_83, 1_04_28, 1_09_29, 1_19_38, 1_20_33, 1_23_31, 1_25_62, 1_37_93,
    1_41_57, 1_46_35, 1_52_65, 1_56_18, 1_65_53, 1_66_04, 1_83_62, 1_89_56, 2_00_75, 2_16_75,
    2_25_20, 2_61_30, 2_61_61, 2_64_35, 2_82_79, 2_94_64, 3_16_50, 3_23_02, 3_24_70, 3_68_65,
    4_28_63, 4_74_25, 4_98_70, 5_02_54, 5_02_58, 5_03_60, 5_03_61, 5_03_62
]







class 						_snake_case    ( _snake_case				):
 SCREAMING_SNAKE_CASE__ =			'whisper'
 SCREAMING_SNAKE_CASE__ =			['past_key_values']
 SCREAMING_SNAKE_CASE__ =			{'num_attention_heads': 'encoder_attention_heads', 'hidden_size': 'd_model'}




 def __init__(						self   ,    _lowerCamelCase=5_1865   ,    _lowerCamelCase=80   ,    _lowerCamelCase=6   ,    _lowerCamelCase=4   ,    _lowerCamelCase=6   ,    _lowerCamelCase=4   ,    _lowerCamelCase=1536   ,    _lowerCamelCase=1536   ,    _lowerCamelCase=0.0   ,    _lowerCamelCase=0.0   ,    _lowerCamelCase=5_0257   ,    _lowerCamelCase=True   ,    _lowerCamelCase=True   ,    _lowerCamelCase="gelu"   ,    _lowerCamelCase=256   ,    _lowerCamelCase=0.0   ,    _lowerCamelCase=0.0   ,    _lowerCamelCase=0.0   ,    _lowerCamelCase=0.02   ,    _lowerCamelCase=False   ,    _lowerCamelCase=1500   ,    _lowerCamelCase=448   ,    _lowerCamelCase=5_0256   ,    _lowerCamelCase=5_0256   ,    _lowerCamelCase=5_0256   ,    _lowerCamelCase=None   ,    _lowerCamelCase=[220, 5_0256]   ,    _lowerCamelCase=False   ,    _lowerCamelCase=256   ,    _lowerCamelCase=False   ,    _lowerCamelCase=0.05   ,    _lowerCamelCase=10   ,    _lowerCamelCase=2   ,    _lowerCamelCase=0.0   ,    _lowerCamelCase=10   ,    _lowerCamelCase=0   ,    _lowerCamelCase=7   ,    **_lowerCamelCase   ,    ):
       a		:List[str]									=			vocab_size
       a		:Tuple									=			num_mel_bins
       a		:List[str]									=			d_model
       a		:int									=			encoder_layers
       a		:Optional[Any]									=			encoder_attention_heads
       a		:Tuple									=			decoder_layers
       a		:Any									=			decoder_attention_heads
       a		:List[str]									=			decoder_ffn_dim
       a		:Tuple									=			encoder_ffn_dim
       a		:Union[str, Any]									=			dropout
       a		:int									=			attention_dropout
       a		:Any									=			activation_dropout
       a		:Dict									=			activation_function
       a		:int									=			init_std
       a		:List[Any]									=			encoder_layerdrop
       a		:str									=			decoder_layerdrop
       a		:List[str]									=			use_cache
       a		:Union[str, Any]									=			encoder_layers
       a		:List[Any]									=			scale_embedding  # scale factor will be sqrt(d_model) if True
       a		:List[str]									=			max_source_positions
       a		:List[Any]									=			max_target_positions

       # Audio Classification-specific parameters. Feel free to ignore for other classes.
       a		:int									=			classifier_proj_size
       a		:str									=			use_weighted_layer_sum

       # fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
       a		:Union[str, Any]									=			apply_spec_augment
       a		:List[Any]									=			mask_time_prob
       a		:Tuple									=			mask_time_length
       a		:Union[str, Any]									=			mask_time_min_masks
       a		:List[Any]									=			mask_feature_prob
       a		:Dict									=			mask_feature_length
       a		:Optional[int]									=			mask_feature_min_masks

       a		:str									=			median_filter_width

       super().__init__(
           pad_token_id=_lowerCamelCase   ,    bos_token_id=_lowerCamelCase   ,    eos_token_id=_lowerCamelCase   ,    is_encoder_decoder=_lowerCamelCase   ,    decoder_start_token_id=_lowerCamelCase   ,    suppress_tokens=_lowerCamelCase   ,    begin_suppress_tokens=_lowerCamelCase   ,    **_lowerCamelCase   ,    )







class 						_snake_case    ( _snake_case				):




 @property
 def 			SCREAMING_SNAKE_CASE__							(						self       ):
       a		:List[Any]									=			OrderedDict(
           [
               ('''input_features''', {0: '''batch''', 1: '''feature_size''', 2: '''encoder_sequence'''}),
           ]       )
       if self.use_past:
             a		:Any									=			{0: '''batch'''}
       else:
             a		:Tuple									=			{0: '''batch''', 1: '''decoder_sequence'''}

       if self.use_past:
             self.fill_with_past_key_values_(_lowerCamelCase   ,    direction='''inputs'''       )

       return common_inputs




 def 			SCREAMING_SNAKE_CASE__							(						self   ,    _lowerCamelCase   ,    _lowerCamelCase = -1   ,    _lowerCamelCase = -1   ,    _lowerCamelCase = False   ,    _lowerCamelCase = None   ,    _lowerCamelCase = 2_2050   ,    _lowerCamelCase = 5.0   ,    _lowerCamelCase = 220   ,    ):
       a		:int									=			OrderedDict()
       a		:List[Any]									=			OnnxConfig.generate_dummy_inputs(
           self   ,    preprocessor=preprocessor.feature_extractor   ,    batch_size=_lowerCamelCase   ,    framework=_lowerCamelCase   ,    sampling_rate=_lowerCamelCase   ,    time_duration=_lowerCamelCase   ,    frequency=_lowerCamelCase   ,    )
       a		:Union[str, Any]									=			encoder_inputs['''input_features'''].shape[2]
       a		:List[str]									=			encoder_sequence_length // 2 if self.use_past else seq_length

       a		:Optional[Any]									=			super().generate_dummy_inputs(
           preprocessor.tokenizer   ,    _lowerCamelCase   ,    _lowerCamelCase   ,    _lowerCamelCase   ,    _lowerCamelCase       )

       a		:Dict									=			encoder_inputs.pop('''input_features'''       )
       a		:List[Any]									=			decoder_inputs.pop('''decoder_input_ids'''       )

       if "past_key_values" in decoder_inputs:
             a		:str									=			decoder_inputs.pop('''past_key_values'''       )

       return dummy_inputs




 @property
 def 			SCREAMING_SNAKE_CASE__							(						self       ):
       return 1e-3









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


snake_case							:       List[Any]										=	logging.get_logger(__name__)

snake_case							:       Dict										=	{
    '''uclanlp/visualbert-vqa''': '''https://huggingface.co/uclanlp/visualbert-vqa/resolve/main/config.json''',
    '''uclanlp/visualbert-vqa-pre''': '''https://huggingface.co/uclanlp/visualbert-vqa-pre/resolve/main/config.json''',
    '''uclanlp/visualbert-vqa-coco-pre''': (
        '''https://huggingface.co/uclanlp/visualbert-vqa-coco-pre/resolve/main/config.json'''
    ),
    '''uclanlp/visualbert-vcr''': '''https://huggingface.co/uclanlp/visualbert-vcr/resolve/main/config.json''',
    '''uclanlp/visualbert-vcr-pre''': '''https://huggingface.co/uclanlp/visualbert-vcr-pre/resolve/main/config.json''',
    '''uclanlp/visualbert-vcr-coco-pre''': (
        '''https://huggingface.co/uclanlp/visualbert-vcr-coco-pre/resolve/main/config.json'''
    ),
    '''uclanlp/visualbert-nlvr2''': '''https://huggingface.co/uclanlp/visualbert-nlvr2/resolve/main/config.json''',
    '''uclanlp/visualbert-nlvr2-pre''': '''https://huggingface.co/uclanlp/visualbert-nlvr2-pre/resolve/main/config.json''',
    '''uclanlp/visualbert-nlvr2-coco-pre''': (
        '''https://huggingface.co/uclanlp/visualbert-nlvr2-coco-pre/resolve/main/config.json'''
    )
    # See all VisualBERT models at https://huggingface.co/models?filter=visual_bert
}







class 						_snake_case    ( _snake_case				):
 SCREAMING_SNAKE_CASE__ =			'visual_bert'




 def __init__(						self   ,    _lowerCamelCase=3_0522   ,    _lowerCamelCase=768   ,    _lowerCamelCase=512   ,    _lowerCamelCase=12   ,    _lowerCamelCase=12   ,    _lowerCamelCase=3072   ,    _lowerCamelCase="gelu"   ,    _lowerCamelCase=0.1   ,    _lowerCamelCase=0.1   ,    _lowerCamelCase=512   ,    _lowerCamelCase=2   ,    _lowerCamelCase=0.02   ,    _lowerCamelCase=1e-12   ,    _lowerCamelCase=False   ,    _lowerCamelCase=True   ,    _lowerCamelCase=1   ,    _lowerCamelCase=0   ,    _lowerCamelCase=2   ,    **_lowerCamelCase   ,    ):
       super().__init__(pad_token_id=_lowerCamelCase   ,    bos_token_id=_lowerCamelCase   ,    eos_token_id=_lowerCamelCase   ,    **_lowerCamelCase       )

       a		:Any									=			vocab_size
       a		:str									=			max_position_embeddings
       a		:str									=			hidden_size
       a		:List[Any]									=			visual_embedding_dim
       a		:str									=			num_hidden_layers
       a		:Optional[int]									=			num_attention_heads
       a		:int									=			intermediate_size
       a		:int									=			hidden_act
       a		:Union[str, Any]									=			hidden_dropout_prob
       a		:List[Any]									=			attention_probs_dropout_prob
       a		:int									=			initializer_range
       a		:List[Any]									=			type_vocab_size
       a		:str									=			layer_norm_eps
       a		:Optional[int]									=			bypass_transformer
       a		:str									=			special_visual_initialize





