


import copy
import os
from typing import TYPE_CHECKING, List, Union


if TYPE_CHECKING:
				pass

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


lowerCAmelCase__			:      Any								=logging.get_logger(__name__)

lowerCAmelCase__			:      Union[str, Any]								={
    'kakaobrain/align-base': 'https://huggingface.co/kakaobrain/align-base/resolve/main/config.json',
}







class 	__lowercase    (__SCREAMING_SNAKE_CASE  ):





							"""simple docstring"""







							_UpperCAmelCase      =						"""align_text_model"""






							def __init__(      self			,						lowerCAmelCase__=3_0_5_2_2			,						lowerCAmelCase__=7_6_8			,						lowerCAmelCase__=1_2			,						lowerCAmelCase__=1_2			,						lowerCAmelCase__=3_0_7_2			,						lowerCAmelCase__="gelu"			,						lowerCAmelCase__=0.1			,						lowerCAmelCase__=0.1			,						lowerCAmelCase__=5_1_2			,						lowerCAmelCase__=2			,						lowerCAmelCase__=0.02			,						lowerCAmelCase__=1E-12			,						lowerCAmelCase__=0			,						lowerCAmelCase__="absolute"			,						lowerCAmelCase__=True			,						**lowerCAmelCase__			,						):





										"""simple docstring"""




										super().__init__(**lowerCAmelCase__       )

										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					vocab_size
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					hidden_size
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					num_hidden_layers
										SCREAMING_SNAKE_CASE_		:     Dict					=					num_attention_heads
										SCREAMING_SNAKE_CASE_		:     Any					=					hidden_act
										SCREAMING_SNAKE_CASE_		:     int					=					intermediate_size
										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					hidden_dropout_prob
										SCREAMING_SNAKE_CASE_		:     Dict					=					attention_probs_dropout_prob
										SCREAMING_SNAKE_CASE_		:     Any					=					max_position_embeddings
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					type_vocab_size
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					initializer_range
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					layer_norm_eps
										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					position_embedding_type
										SCREAMING_SNAKE_CASE_		:     Dict					=					use_cache
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					pad_token_id






							@classmethod
							def 					UpperCamelCase__     (      cls			,						lowerCAmelCase__			,						**lowerCAmelCase__       ):





										"""simple docstring"""




										cls._set_token_in_kwargs(lowerCAmelCase__       )

										SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		:     Dict					=					cls.get_config_dict(lowerCAmelCase__			,						**lowerCAmelCase__       )

										# get the text config dict if we are loading from AlignConfig
										if config_dict.get('model_type'       ) == "align":
													SCREAMING_SNAKE_CASE_		:     str					=					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 	__lowercase    (__SCREAMING_SNAKE_CASE  ):





							"""simple docstring"""







							_UpperCAmelCase      =						"""align_vision_model"""






							def __init__(      self			,						lowerCAmelCase__ = 3			,						lowerCAmelCase__ = 6_0_0			,						lowerCAmelCase__ = 2.0			,						lowerCAmelCase__ = 3.1			,						lowerCAmelCase__ = 8			,						lowerCAmelCase__ = [3, 3, 5, 3, 5, 5, 3]			,						lowerCAmelCase__ = [3_2, 1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2]			,						lowerCAmelCase__ = [1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2, 3_2_0]			,						lowerCAmelCase__ = []			,						lowerCAmelCase__ = [1, 2, 2, 2, 1, 2, 1]			,						lowerCAmelCase__ = [1, 2, 2, 3, 3, 4, 1]			,						lowerCAmelCase__ = [1, 6, 6, 6, 6, 6, 6]			,						lowerCAmelCase__ = 0.25			,						lowerCAmelCase__ = "swish"			,						lowerCAmelCase__ = 2_5_6_0			,						lowerCAmelCase__ = "mean"			,						lowerCAmelCase__ = 0.02			,						lowerCAmelCase__ = 0.001			,						lowerCAmelCase__ = 0.99			,						lowerCAmelCase__ = 0.2			,						**lowerCAmelCase__			,						):





										"""simple docstring"""




										super().__init__(**lowerCAmelCase__       )

										SCREAMING_SNAKE_CASE_		:     str					=					num_channels
										SCREAMING_SNAKE_CASE_		:     Dict					=					image_size
										SCREAMING_SNAKE_CASE_		:     int					=					width_coefficient
										SCREAMING_SNAKE_CASE_		:     int					=					depth_coefficient
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					depth_divisor
										SCREAMING_SNAKE_CASE_		:     int					=					kernel_sizes
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					in_channels
										SCREAMING_SNAKE_CASE_		:     Dict					=					out_channels
										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					depthwise_padding
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					strides
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					num_block_repeats
										SCREAMING_SNAKE_CASE_		:     int					=					expand_ratios
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					squeeze_expansion_ratio
										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					hidden_act
										SCREAMING_SNAKE_CASE_		:     Tuple					=					hidden_dim
										SCREAMING_SNAKE_CASE_		:     int					=					pooling_type
										SCREAMING_SNAKE_CASE_		:     Dict					=					initializer_range
										SCREAMING_SNAKE_CASE_		:     int					=					batch_norm_eps
										SCREAMING_SNAKE_CASE_		:     int					=					batch_norm_momentum
										SCREAMING_SNAKE_CASE_		:     Tuple					=					drop_connect_rate
										SCREAMING_SNAKE_CASE_		:     List[str]					=					sum(lowerCAmelCase__       ) * 4






							@classmethod
							def 					UpperCamelCase__     (      cls			,						lowerCAmelCase__			,						**lowerCAmelCase__       ):





										"""simple docstring"""




										cls._set_token_in_kwargs(lowerCAmelCase__       )

										SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		:     List[Any]					=					cls.get_config_dict(lowerCAmelCase__			,						**lowerCAmelCase__       )

										# get the vision config dict if we are loading from AlignConfig
										if config_dict.get('model_type'       ) == "align":
													SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					config_dict['vision_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 	__lowercase    (__SCREAMING_SNAKE_CASE  ):





							"""simple docstring"""







							_UpperCAmelCase      =						"""align"""
							_UpperCAmelCase      =						True






							def __init__(      self			,						lowerCAmelCase__=None			,						lowerCAmelCase__=None			,						lowerCAmelCase__=6_4_0			,						lowerCAmelCase__=1.0			,						lowerCAmelCase__=0.02			,						**lowerCAmelCase__			,						):





										"""simple docstring"""




										super().__init__(**lowerCAmelCase__       )

										if text_config is None:
													SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					{}
													logger.info('text_config is None. Initializing the AlignTextConfig with default values.'       )

										if vision_config is None:
													SCREAMING_SNAKE_CASE_		:     List[Any]					=					{}
													logger.info('vision_config is None. Initializing the AlignVisionConfig with default values.'       )

										SCREAMING_SNAKE_CASE_		:     Tuple					=					AlignTextConfig(**lowerCAmelCase__       )
										SCREAMING_SNAKE_CASE_		:     Tuple					=					AlignVisionConfig(**lowerCAmelCase__       )

										SCREAMING_SNAKE_CASE_		:     Any					=					projection_dim
										SCREAMING_SNAKE_CASE_		:     str					=					temperature_init_value
										SCREAMING_SNAKE_CASE_		:     int					=					initializer_range






							@classmethod
							def 					UpperCamelCase__     (      cls			,						lowerCAmelCase__			,						lowerCAmelCase__			,						**lowerCAmelCase__       ):





										"""simple docstring"""




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






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					copy.deepcopy(self.__dict__       )
										SCREAMING_SNAKE_CASE_		:     Any					=					self.text_config.to_dict()
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					self.vision_config.to_dict()
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					self.__class__.model_type
										return output









from . import (
    albert,
    align,
    altclip,
    audio_spectrogram_transformer,
    auto,
    autoformer,
    bark,
    bart,
    barthez,
    bartpho,
    beit,
    bert,
    bert_generation,
    bert_japanese,
    bertweet,
    big_bird,
    bigbird_pegasus,
    biogpt,
    bit,
    blenderbot,
    blenderbot_small,
    blip,
    blip_a,
    bloom,
    bridgetower,
    byta,
    camembert,
    canine,
    chinese_clip,
    clap,
    clip,
    clipseg,
    codegen,
    conditional_detr,
    convbert,
    convnext,
    convnextva,
    cpm,
    cpmant,
    ctrl,
    cvt,
    dataavec,
    deberta,
    deberta_va,
    decision_transformer,
    deformable_detr,
    deit,
    deprecated,
    deta,
    detr,
    dialogpt,
    dinat,
    distilbert,
    dit,
    donut,
    dpr,
    dpt,
    efficientformer,
    efficientnet,
    electra,
    encodec,
    encoder_decoder,
    ernie,
    ernie_m,
    esm,
    falcon,
    flaubert,
    flava,
    fnet,
    focalnet,
    fsmt,
    funnel,
    git,
    glpn,
    gpta,
    gpt_bigcode,
    gpt_neo,
    gpt_neox,
    gpt_neox_japanese,
    gpt_swa,
    gptj,
    gptsan_japanese,
    graphormer,
    groupvit,
    herbert,
    hubert,
    ibert,
    imagegpt,
    informer,
    instructblip,
    jukebox,
    layoutlm,
    layoutlmva,
    layoutlmva,
    layoutxlm,
    led,
    levit,
    lilt,
    llama,
    longformer,
    longta,
    luke,
    lxmert,
    mam_aaa,
    marian,
    markuplm,
    maskaformer,
    maskformer,
    mbart,
    mbartaa,
    mega,
    megatron_bert,
    megatron_gpta,
    mgp_str,
    mluke,
    mobilebert,
    mobilenet_va,
    mobilenet_va,
    mobilevit,
    mobilevitva,
    mpnet,
    mra,
    mta,
    musicgen,
    mvp,
    nat,
    nezha,
    nllb,
    nllb_moe,
    nystromformer,
    oneformer,
    open_llama,
    openai,
    opt,
    owlvit,
    pegasus,
    pegasus_x,
    perceiver,
    phobert,
    pixastruct,
    plbart,
    poolformer,
    prophetnet,
    qdqbert,
    rag,
    realm,
    reformer,
    regnet,
    rembert,
    resnet,
    roberta,
    roberta_prelayernorm,
    roc_bert,
    roformer,
    rwkv,
    sam,
    segformer,
    sew,
    sew_d,
    speech_encoder_decoder,
    speech_to_text,
    speech_to_text_a,
    speechta,
    splinter,
    squeezebert,
    swiftformer,
    swin,
    swinasr,
    swinva,
    switch_transformers,
    ta,
    table_transformer,
    tapas,
    time_series_transformer,
    timesformer,
    timm_backbone,
    transfo_xl,
    trocr,
    tvlt,
    umta,
    unispeech,
    unispeech_sat,
    upernet,
    videomae,
    vilt,
    vision_encoder_decoder,
    vision_text_dual_encoder,
    visual_bert,
    vit,
    vit_hybrid,
    vit_mae,
    vit_msn,
    vivit,
    wavaveca,
    wavaveca_conformer,
    wavaveca_phoneme,
    wavaveca_with_lm,
    wavlm,
    whisper,
    x_clip,
    xglm,
    xlm,
    xlm_prophetnet,
    xlm_roberta,
    xlm_roberta_xl,
    xlnet,
    xmod,
    yolos,
    yoso,
)





