






"""simple docstring"""

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


if TYPE_CHECKING:
					pass

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


lowercase__          = logging.get_logger(__name__)

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


class 		__lowerCamelCase				( A__			):





		'''simple docstring'''






		a_	:				Optional[Any]            =							"""align_text_model"""





		def __init__(   self							:	int						,			a_							:	Union[str, Any]=3_05_22						,			a_							:	Any=7_68						,			a_							:	Any=12						,			a_							:	Any=12						,			a_							:	Union[str, Any]=30_72						,			a_							:	List[str]="gelu"						,			a_							:	Optional[Any]=0.1						,			a_							:	Optional[int]=0.1						,			a_							:	str=5_12						,			a_							:	Dict=2						,			a_							:	Dict=0.02						,			a_							:	int=1e-1_2						,			a_							:	List[str]=0						,			a_							:	Tuple="absolute"						,			a_							:	Any=True						,			**a_							:	Optional[Any]						,			):
				super().__init__(**a_	)

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





		@classmethod
		def    lowerCamelCase       (   cls							:	List[Any]						,			a_							:	Union[str, os.PathLike]						,			**a_							:	List[str]	):
				cls._set_token_in_kwargs(a_	)

				lowerCAmelCase_				,	lowerCAmelCase_   :							Union[str, 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":
						lowerCAmelCase_   :							Optional[int]									=			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 		__lowerCamelCase				( A__			):





		'''simple docstring'''






		a_	:				Optional[int]            =							"""align_vision_model"""





		def __init__(   self							:	Dict						,			a_							:	int = 3						,			a_							:	int = 6_00						,			a_							:	float = 2.0						,			a_							:	float = 3.1						,			a_							:	int = 8						,			a_							:	List[int] = [3, 3, 5, 3, 5, 5, 3]						,			a_							:	List[int] = [32, 16, 24, 40, 80, 1_12, 1_92]						,			a_							:	List[int] = [16, 24, 40, 80, 1_12, 1_92, 3_20]						,			a_							:	List[int] = []						,			a_							:	List[int] = [1, 2, 2, 2, 1, 2, 1]						,			a_							:	List[int] = [1, 2, 2, 3, 3, 4, 1]						,			a_							:	List[int] = [1, 6, 6, 6, 6, 6, 6]						,			a_							:	float = 0.25						,			a_							:	str = "swish"						,			a_							:	int = 25_60						,			a_							:	str = "mean"						,			a_							:	float = 0.02						,			a_							:	float = 0.001						,			a_							:	float = 0.99						,			a_							:	float = 0.2						,			**a_							:	Dict						,			):
				super().__init__(**a_	)

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





		@classmethod
		def    lowerCamelCase       (   cls							:	int						,			a_							:	Union[str, os.PathLike]						,			**a_							:	Any	):
				cls._set_token_in_kwargs(a_	)

				lowerCAmelCase_				,	lowerCAmelCase_   :							Union[str, Any]									=			cls.get_config_dict(a_						,			**a_	)

				# get the vision config dict if we are loading from AlignConfig
				if config_dict.get("model_type"	) == "align":
						lowerCAmelCase_   :							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(a_						,			**a_	)







class 		__lowerCamelCase				( A__			):





		'''simple docstring'''






		a_	:				Union[str, Any]            =							"""align"""
		a_	:				int            =							True





		def __init__(   self							:	Union[str, Any]						,			a_							:	List[str]=None						,			a_							:	List[Any]=None						,			a_							:	Dict=6_40						,			a_							:	Optional[int]=1.0						,			a_							:	Tuple=0.02						,			**a_							:	Dict						,			):
				super().__init__(**a_	)

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

				if vision_config is None:
						lowerCAmelCase_   :							Optional[Any]									=			{}
						logger.info("vision_config is None. Initializing the AlignVisionConfig with default values."	)

				lowerCAmelCase_   :							List[str]									=			AlignTextConfig(**a_	)
				lowerCAmelCase_   :							Union[str, Any]									=			AlignVisionConfig(**a_	)

				lowerCAmelCase_   :							Optional[int]									=			projection_dim
				lowerCAmelCase_   :							str									=			temperature_init_value
				lowerCAmelCase_   :							Any									=			initializer_range





		@classmethod
		def    lowerCamelCase       (   cls							:	List[Any]						,			a_							:	AlignTextConfig						,			a_							:	AlignVisionConfig						,			**a_							:	List[str]	):
				return cls(text_config=text_config.to_dict()						,			vision_config=vision_config.to_dict()						,			**a_	)





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








"""simple docstring"""

# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# this script dumps information about the environment

import os
import platform
import sys


lowercase__          = """3"""

print("""Python version:""", sys.version)

print("""OS platform:""", platform.platform())
print("""OS architecture:""", platform.machine())

try:
					import torch

					print("""Torch version:""", torch.__version__)
					print("""Cuda available:""", torch.cuda.is_available())
					print("""Cuda version:""", torch.version.cuda)
					print("""CuDNN version:""", torch.backends.cudnn.version())
					print("""Number of GPUs available:""", torch.cuda.device_count())
except ImportError:
					print("""Torch version:""", None)

try:
					import transformers

					print("""transformers version:""", transformers.__version__)
except ImportError:
					print("""transformers version:""", None)
