'''simple docstring'''


import copy
import os
from typing import Union

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


__lowerCAmelCase	:       Any						       =	logging.get_logger(__name__)

__lowerCAmelCase	:       Union[str, Any]						       =	{
    "Salesforce/blip-vqa-base": "https://huggingface.co/Salesforce/blip-vqa-base/resolve/main/config.json",
    "Salesforce/blip-vqa-capfit-large": (
        "https://huggingface.co/Salesforce/blip-vqa-base-capfit/resolve/main/config.json"
    ),
    "Salesforce/blip-image-captioning-base": (
        "https://huggingface.co/Salesforce/blip-image-captioning-base/resolve/main/config.json"
    ),
    "Salesforce/blip-image-captioning-large": (
        "https://huggingface.co/Salesforce/blip-image-captioning-large/resolve/main/config.json"
    ),
    "Salesforce/blip-itm-base-coco": "https://huggingface.co/Salesforce/blip-itm-base-coco/resolve/main/config.json",
    "Salesforce/blip-itm-large-coco": "https://huggingface.co/Salesforce/blip-itm-large-coco/resolve/main/config.json",
    "Salesforce/blip-itm-base-flikr": "https://huggingface.co/Salesforce/blip-itm-base-flikr/resolve/main/config.json",
    "Salesforce/blip-itm-large-flikr": (
        "https://huggingface.co/Salesforce/blip-itm-large-flikr/resolve/main/config.json"
    ),
}






class 						A   (   UpperCamelCase_   ):

							'''simple docstring'''





							a_        =      '''blip_text_model'''





							def __init__(      self				:							str     ,		__a				:							Optional[int]=3_0_5_2_4     ,		__a				:							List[str]=7_6_8     ,		__a				:							List[str]=7_6_8     ,		__a				:							Union[str, Any]=3_0_7_2     ,		__a				:							Dict=7_6_8     ,		__a				:							str=1_2     ,		__a				:							str=8     ,		__a				:							List[str]=5_1_2     ,		__a				:							int="gelu"     ,		__a				:							List[Any]=1e-12     ,		__a				:							Optional[int]=0.0     ,		__a				:							Tuple=0.0     ,		__a				:							Any=0.0_2     ,		__a				:							Tuple=3_0_5_2_2     ,		__a				:							Optional[int]=2     ,		__a				:							Any=0     ,		__a				:							Dict=1_0_2     ,		__a				:							Tuple=True     ,		__a				:							Tuple=True     ,		**__a				:							int     ,		)							->	Tuple:
								super().__init__(
								    pad_token_id=__a     ,		bos_token_id=__a     ,		eos_token_id=__a     ,		sep_token_id=__a     ,		**__a     ,		)

								__UpperCAmelCase							=			vocab_size
								__UpperCAmelCase							=			hidden_size
								__UpperCAmelCase							=			encoder_hidden_size
								__UpperCAmelCase							=			intermediate_size
								__UpperCAmelCase							=			projection_dim
								__UpperCAmelCase							=			hidden_dropout_prob
								__UpperCAmelCase							=			num_hidden_layers
								__UpperCAmelCase							=			num_attention_heads
								__UpperCAmelCase							=			max_position_embeddings
								__UpperCAmelCase							=			layer_norm_eps
								__UpperCAmelCase							=			hidden_act
								__UpperCAmelCase							=			initializer_range
								__UpperCAmelCase							=			attention_probs_dropout_prob
								__UpperCAmelCase							=			is_decoder
								__UpperCAmelCase							=			use_cache






							@classmethod
							def       snake_case__						(      cls				:							Any     ,		__a				:							List[str]     ,		**__a				:							Optional[Any]	)							->	"PretrainedConfig":
								cls._set_token_in_kwargs(__a	)

								__UpperCAmelCase							=			cls.get_config_dict(__a     ,		**__a	)

								# get the text config dict if we are loading from BlipConfig
								if config_dict.get('''model_type'''	) == "blip":
									__UpperCAmelCase							=			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(__a     ,		**__a	)






class 						A   (   UpperCamelCase_   ):

							'''simple docstring'''





							a_        =      '''blip_vision_model'''





							def __init__(      self				:							Optional[Any]     ,		__a				:							Tuple=7_6_8     ,		__a				:							Dict=3_0_7_2     ,		__a				:							int=5_1_2     ,		__a				:							Any=1_2     ,		__a				:							Union[str, Any]=1_2     ,		__a				:							List[str]=3_8_4     ,		__a				:							Dict=1_6     ,		__a				:							Dict="gelu"     ,		__a				:							Optional[int]=1e-5     ,		__a				:							str=0.0     ,		__a				:							Optional[Any]=1e-10     ,		**__a				:							Any     ,		)							->	int:
								super().__init__(**__a	)

								__UpperCAmelCase							=			hidden_size
								__UpperCAmelCase							=			intermediate_size
								__UpperCAmelCase							=			projection_dim
								__UpperCAmelCase							=			num_hidden_layers
								__UpperCAmelCase							=			num_attention_heads
								__UpperCAmelCase							=			patch_size
								__UpperCAmelCase							=			image_size
								__UpperCAmelCase							=			initializer_range
								__UpperCAmelCase							=			attention_dropout
								__UpperCAmelCase							=			layer_norm_eps
								__UpperCAmelCase							=			hidden_act






							@classmethod
							def       snake_case__						(      cls				:							Optional[int]     ,		__a				:							int     ,		**__a				:							int	)							->	"PretrainedConfig":
								cls._set_token_in_kwargs(__a	)

								__UpperCAmelCase							=			cls.get_config_dict(__a     ,		**__a	)

								# get the vision config dict if we are loading from BlipConfig
								if config_dict.get('''model_type'''	) == "blip":
									__UpperCAmelCase							=			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(__a     ,		**__a	)






class 						A   (   UpperCamelCase_   ):

							'''simple docstring'''





							a_        =      '''blip'''
							a_        =      True





							def __init__(      self				:							Optional[int]     ,		__a				:							Tuple=None     ,		__a				:							Optional[Any]=None     ,		__a				:							Union[str, Any]=5_1_2     ,		__a				:							str=2.6_5_9_2     ,		__a				:							Tuple=2_5_6     ,		**__a				:							Union[str, Any]     ,		)							->	List[str]:
								super().__init__(**__a	)

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

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

								__UpperCAmelCase							=			BlipTextConfig(**__a	)
								__UpperCAmelCase							=			BlipVisionConfig(**__a	)

								__UpperCAmelCase							=			self.vision_config.hidden_size

								__UpperCAmelCase							=			projection_dim
								__UpperCAmelCase							=			logit_scale_init_value
								__UpperCAmelCase							=			1.0
								__UpperCAmelCase							=			0.0_2
								__UpperCAmelCase							=			image_text_hidden_size





							@classmethod
							def       snake_case__						(      cls				:							Union[str, Any]     ,		__a				:							Dict     ,		__a				:							str     ,		**__a				:							Optional[int]	)							->	Any:
								return cls(text_config=text_config.to_dict()     ,		vision_config=vision_config.to_dict()     ,		**__a	)






							def       snake_case__						(      self				:							int	)							->	Any:
								__UpperCAmelCase							=			copy.deepcopy(self.__dict__	)
								__UpperCAmelCase							=			self.text_config.to_dict()
								__UpperCAmelCase							=			self.vision_config.to_dict()
								__UpperCAmelCase							=			self.__class__.model_type
								return output

'''simple docstring'''


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available


__lowerCAmelCase	:       List[Any]						       =	{
    "configuration_audio_spectrogram_transformer": [
        "AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "ASTConfig",
    ]
}

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					__lowerCAmelCase	:       str						       =	[
					    "AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
					    "ASTForAudioClassification",
					    "ASTModel",
					    "ASTPreTrainedModel",
					]

try:
					if not is_speech_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					__lowerCAmelCase	:       Union[str, Any]						       =	["ASTFeatureExtractor"]

if TYPE_CHECKING:
					from .configuration_audio_spectrogram_transformer import (
					    AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
					    ASTConfig,
					)

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_audio_spectrogram_transformer import (
										    AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
										    ASTForAudioClassification,
										    ASTModel,
										    ASTPreTrainedModel,
										)

					try:
										if not is_speech_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .feature_extraction_audio_spectrogram_transformer import ASTFeatureExtractor


else:
					import sys

					__lowerCAmelCase	:       Optional[Any]						       =	_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
