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


if TYPE_CHECKING:
				pass

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


snake_case :		Union[str, Any]							      =  logging.get_logger(__name__)

snake_case :		int							      =  {
    "kakaobrain/align-base": "https://huggingface.co/kakaobrain/align-base/resolve/main/config.json",
}





class       _snake_case					(     snake_case				):
			UpperCamelCase__          =    'align_text_model'







			def __init__(				self						,   _a=30_522						,   _a=768						,   _a=12						,   _a=12						,   _a=3_072						,   _a="gelu"						,   _a=0.1						,   _a=0.1						,   _a=512						,   _a=2						,   _a=0.02						,   _a=1e-12						,   _a=0						,   _a="absolute"						,   _a=True						,   **_a						,   ):
				super().__init__(**_a		)

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







			@classmethod
			def 			SCREAMING_SNAKE_CASE    (				cls						,   _a						,   **_a		):
				cls._set_token_in_kwargs(_a		)

				__magic_name__   ,    __magic_name__		:		List[Any]	   =     cls.get_config_dict(_a						,   **_a		)

				# get the text config dict if we are loading from AlignConfig
				if config_dict.get("model_type"		) == "align":
					__magic_name__		:		Union[str, Any]	   =     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       _snake_case					(     snake_case				):
			UpperCamelCase__          =    'align_vision_model'







			def __init__(				self						,   _a = 3						,   _a = 600						,   _a = 2.0						,   _a = 3.1						,   _a = 8						,   _a = [3, 3, 5, 3, 5, 5, 3]						,   _a = [32, 16, 24, 40, 80, 112, 192]						,   _a = [16, 24, 40, 80, 112, 192, 320]						,   _a = []						,   _a = [1, 2, 2, 2, 1, 2, 1]						,   _a = [1, 2, 2, 3, 3, 4, 1]						,   _a = [1, 6, 6, 6, 6, 6, 6]						,   _a = 0.25						,   _a = "swish"						,   _a = 2_560						,   _a = "mean"						,   _a = 0.02						,   _a = 0.0_01						,   _a = 0.99						,   _a = 0.2						,   **_a						,   ):
				super().__init__(**_a		)

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







			@classmethod
			def 			SCREAMING_SNAKE_CASE    (				cls						,   _a						,   **_a		):
				cls._set_token_in_kwargs(_a		)

				__magic_name__   ,    __magic_name__		:		List[str]	   =     cls.get_config_dict(_a						,   **_a		)

				# get the vision config dict if we are loading from AlignConfig
				if config_dict.get("model_type"		) == "align":
					__magic_name__		:		Optional[int]	   =     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       _snake_case					(     snake_case				):
			UpperCamelCase__          =    'align'
			UpperCamelCase__          =    True







			def __init__(				self						,   _a=None						,   _a=None						,   _a=640						,   _a=1.0						,   _a=0.02						,   **_a						,   ):
				super().__init__(**_a		)

				if text_config is None:
					__magic_name__		:		int	   =     {}
					logger.info("text_config is None. Initializing the AlignTextConfig with default values."		)

				if vision_config is None:
					__magic_name__		:		Union[str, Any]	   =     {}
					logger.info("vision_config is None. Initializing the AlignVisionConfig with default values."		)

				__magic_name__		:		Union[str, Any]	   =     AlignTextConfig(**_a		)
				__magic_name__		:		Any	   =     AlignVisionConfig(**_a		)

				__magic_name__		:		Tuple	   =     projection_dim
				__magic_name__		:		List[str]	   =     temperature_init_value
				__magic_name__		:		Optional[Any]	   =     initializer_range







			@classmethod
			def 			SCREAMING_SNAKE_CASE    (				cls						,   _a						,   _a						,   **_a		):
				return cls(text_config=text_config.to_dict()						,   vision_config=vision_config.to_dict()						,   **_a		)







			def 			SCREAMING_SNAKE_CASE    (				self		):
				__magic_name__		:		Optional[Any]	   =     copy.deepcopy(self.__dict__		)
				__magic_name__		:		Optional[int]	   =     self.text_config.to_dict()
				__magic_name__		:		Tuple	   =     self.vision_config.to_dict()
				__magic_name__		:		List[Any]	   =     self.__class__.model_type
				return output


from . import __version__

# Backward compatibility imports, to make sure all those objects can be found in file_utils
from .utils import (
    CLOUDFRONT_DISTRIB_PREFIX,
    CONFIG_NAME,
    DISABLE_TELEMETRY,
    DUMMY_INPUTS,
    DUMMY_MASK,
    ENV_VARS_TRUE_AND_AUTO_VALUES,
    ENV_VARS_TRUE_VALUES,
    FEATURE_EXTRACTOR_NAME,
    FLAX_WEIGHTS_NAME,
    HF_MODULES_CACHE,
    HUGGINGFACE_CO_PREFIX,
    HUGGINGFACE_CO_RESOLVE_ENDPOINT,
    MODEL_CARD_NAME,
    MULTIPLE_CHOICE_DUMMY_INPUTS,
    PYTORCH_PRETRAINED_BERT_CACHE,
    PYTORCH_TRANSFORMERS_CACHE,
    S3_BUCKET_PREFIX,
    SENTENCEPIECE_UNDERLINE,
    SPIECE_UNDERLINE,
    TF2_WEIGHTS_NAME,
    TF_WEIGHTS_NAME,
    TORCH_FX_REQUIRED_VERSION,
    TRANSFORMERS_CACHE,
    TRANSFORMERS_DYNAMIC_MODULE_NAME,
    USE_JAX,
    USE_TF,
    USE_TORCH,
    WEIGHTS_INDEX_NAME,
    WEIGHTS_NAME,
    ContextManagers,
    DummyObject,
    EntryNotFoundError,
    ExplicitEnum,
    ModelOutput,
    PaddingStrategy,
    PushToHubMixin,
    RepositoryNotFoundError,
    RevisionNotFoundError,
    TensorType,
    _LazyModule,
    add_code_sample_docstrings,
    add_end_docstrings,
    add_start_docstrings,
    add_start_docstrings_to_model_forward,
    cached_property,
    copy_func,
    default_cache_path,
    define_sagemaker_information,
    get_cached_models,
    get_file_from_repo,
    get_full_repo_name,
    get_torch_version,
    has_file,
    http_user_agent,
    is_apex_available,
    is_bsa_available,
    is_coloredlogs_available,
    is_datasets_available,
    is_detectrona_available,
    is_faiss_available,
    is_flax_available,
    is_ftfy_available,
    is_in_notebook,
    is_ipex_available,
    is_librosa_available,
    is_offline_mode,
    is_onnx_available,
    is_pandas_available,
    is_phonemizer_available,
    is_protobuf_available,
    is_psutil_available,
    is_pyanvml_available,
    is_pyctcdecode_available,
    is_pytesseract_available,
    is_pytorch_quantization_available,
    is_rjieba_available,
    is_sagemaker_dp_enabled,
    is_sagemaker_mp_enabled,
    is_scipy_available,
    is_sentencepiece_available,
    is_seqio_available,
    is_sklearn_available,
    is_soundfile_availble,
    is_spacy_available,
    is_speech_available,
    is_tensor,
    is_tensorflow_probability_available,
    is_tfaonnx_available,
    is_tf_available,
    is_timm_available,
    is_tokenizers_available,
    is_torch_available,
    is_torch_bfaa_available,
    is_torch_cuda_available,
    is_torch_fx_available,
    is_torch_fx_proxy,
    is_torch_mps_available,
    is_torch_tfaa_available,
    is_torch_tpu_available,
    is_torchaudio_available,
    is_training_run_on_sagemaker,
    is_vision_available,
    replace_return_docstrings,
    requires_backends,
    to_numpy,
    to_py_obj,
    torch_only_method,
)
