


"""simple docstring"""
import copy
import os
from typing import Union

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


__SCREAMING_SNAKE_CASE							:      Dict						=      logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE							:      Tuple						=      {
    'BAAI/AltCLIP': 'https://huggingface.co/BAAI/AltCLIP/resolve/main/config.json',
    # See all AltCLIP models at https://huggingface.co/models?filter=altclip
}





class        __A       (snake_case__):





							'''simple docstring'''

							__lowercase:						Optional[Any]							 =      """altclip_text_model"""



							def __init__(			self							: Optional[Any]						,    UpperCAmelCase_							: Tuple=250_002						,    UpperCAmelCase_							: Dict=1_024						,    UpperCAmelCase_							: Union[str, Any]=24						,    UpperCAmelCase_							: int=16						,    UpperCAmelCase_							: Tuple=4_096						,    UpperCAmelCase_							: Dict="gelu"						,    UpperCAmelCase_							: int=0.1						,    UpperCAmelCase_							: Optional[Any]=0.1						,    UpperCAmelCase_							: Optional[Any]=514						,    UpperCAmelCase_							: int=1						,    UpperCAmelCase_							: Union[str, Any]=0.02						,    UpperCAmelCase_							: Any=0.02						,    UpperCAmelCase_							: Optional[int]=1E-05						,    UpperCAmelCase_							: Union[str, Any]=1						,    UpperCAmelCase_							: Dict=0						,    UpperCAmelCase_							: List[str]=2						,    UpperCAmelCase_							: Any="absolute"						,    UpperCAmelCase_							: List[Any]=True						,    UpperCAmelCase_							: Any=768						,    **UpperCAmelCase_							: Tuple						,    )   ->List[str]:



														"""simple docstring"""



														super().__init__(pad_token_id=UpperCAmelCase_						,    bos_token_id=UpperCAmelCase_						,    eos_token_id=UpperCAmelCase_						,    **UpperCAmelCase_    )

														snake_case_          =						vocab_size
														snake_case_          =						hidden_size
														snake_case_          =						num_hidden_layers
														snake_case_          =						num_attention_heads
														snake_case_          =						hidden_act
														snake_case_          =						intermediate_size
														snake_case_          =						hidden_dropout_prob
														snake_case_          =						attention_probs_dropout_prob
														snake_case_          =						max_position_embeddings
														snake_case_          =						type_vocab_size
														snake_case_          =						initializer_range
														snake_case_          =						initializer_factor
														snake_case_          =						layer_norm_eps
														snake_case_          =						position_embedding_type
														snake_case_          =						use_cache
														snake_case_          =						project_dim





class        __A       (snake_case__):





							'''simple docstring'''

							__lowercase:						Any							 =      """altclip_vision_model"""



							def __init__(			self							: Dict						,    UpperCAmelCase_							: Dict=768						,    UpperCAmelCase_							: Union[str, Any]=3_072						,    UpperCAmelCase_							: Any=512						,    UpperCAmelCase_							: Optional[int]=12						,    UpperCAmelCase_							: Optional[int]=12						,    UpperCAmelCase_							: Union[str, Any]=3						,    UpperCAmelCase_							: Tuple=224						,    UpperCAmelCase_							: Optional[int]=32						,    UpperCAmelCase_							: Tuple="quick_gelu"						,    UpperCAmelCase_							: int=1E-5						,    UpperCAmelCase_							: Tuple=0.0						,    UpperCAmelCase_							: str=0.02						,    UpperCAmelCase_							: int=1.0						,    **UpperCAmelCase_							: Union[str, Any]						,    )   ->Optional[int]:



														"""simple docstring"""



														super().__init__(**UpperCAmelCase_    )

														snake_case_          =						hidden_size
														snake_case_          =						intermediate_size
														snake_case_          =						projection_dim
														snake_case_          =						num_hidden_layers
														snake_case_          =						num_attention_heads
														snake_case_          =						num_channels
														snake_case_          =						patch_size
														snake_case_          =						image_size
														snake_case_          =						initializer_range
														snake_case_          =						initializer_factor
														snake_case_          =						attention_dropout
														snake_case_          =						layer_norm_eps
														snake_case_          =						hidden_act



							@classmethod
							def 						lowerCAmelCase    (			cls							: List[str]						,    UpperCAmelCase_							: Union[str, os.PathLike]						,    **UpperCAmelCase_							: List[str]    )   ->"PretrainedConfig":



														"""simple docstring"""



														cls._set_token_in_kwargs(UpperCAmelCase_    )

														snake_case_    ,  snake_case_          =						cls.get_config_dict(UpperCAmelCase_						,    **UpperCAmelCase_    )

														# get the vision config dict if we are loading from AltCLIPConfig
														if config_dict.get("""model_type"""    ) == "altclip":
																					snake_case_          =						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(UpperCAmelCase_						,    **UpperCAmelCase_    )





class        __A       (snake_case__):





							'''simple docstring'''

							__lowercase:						Union[str, Any]							 =      """altclip"""
							__lowercase:						List[Any]							 =      True



							def __init__(			self							: Optional[int]						,    UpperCAmelCase_							: Tuple=None						,    UpperCAmelCase_							: List[Any]=None						,    UpperCAmelCase_							: Dict=768						,    UpperCAmelCase_							: Union[str, Any]=2.6_592						,    **UpperCAmelCase_							: Optional[Any]    )   ->Any:



														"""simple docstring"""



														snake_case_          =						kwargs.pop("""text_config_dict"""						,    UpperCAmelCase_    )
														snake_case_          =						kwargs.pop("""vision_config_dict"""						,    UpperCAmelCase_    )

														super().__init__(**UpperCAmelCase_    )

														# Instead of simply assigning `[text|vision]_config_dict` to `[text|vision]_config`, we use the values in
														# `[text|vision]_config_dict` to update the values in `[text|vision]_config`. The values should be same in most
														# cases, but we don't want to break anything regarding `_config_dict` that existed before commit `8827e1b2`.
														if text_config_dict is not None:
																					if text_config is None:
																												snake_case_          =						{}

																					# This is the complete result when using `text_config_dict`.
																					snake_case_          =						AltCLIPTextConfig(**UpperCAmelCase_    ).to_dict()

																					# Give a warning if the values exist in both `_text_config_dict` and `text_config` but being different.
																					for key, value in _text_config_dict.items():
																												if key in text_config and value != text_config[key] and key not in ["transformers_version"]:
																																			# If specified in `text_config_dict`
																																			if key in text_config_dict:
																																										snake_case_          =						(
																																										    F"""`{key}` is found in both `text_config_dict` and `text_config` but with different values. """
																																										    F"""The value `text_config_dict[\"{key}\"]` will be used instead."""
																																										)
																																			# If inferred from default argument values (just to be super careful)
																																			else:
																																										snake_case_          =						(
																																										    F"""`text_config_dict` is provided which will be used to initialize `AltCLIPTextConfig`. The """
																																										    F"""value `text_config[\"{key}\"]` will be overriden."""
																																										)
																																			logger.warning(UpperCAmelCase_    )

            # Update all values in `text_config` with the ones in `_text_config_dict`.
																					text_config.update(_text_config_dict    )

														if vision_config_dict is not None:
																					if vision_config is None:
																												snake_case_          =						{}

																					# This is the complete result when using `vision_config_dict`.
																					snake_case_          =						AltCLIPVisionConfig(**UpperCAmelCase_    ).to_dict()
																					# convert keys to string instead of integer
																					if "id2label" in _vision_config_dict:
																												snake_case_          =						{
																												    str(UpperCAmelCase_    ): value for key, value in _vision_config_dict["""id2label"""].items()
																												}

																					# Give a warning if the values exist in both `_vision_config_dict` and `vision_config` but being different.
																					for key, value in _vision_config_dict.items():
																												if key in vision_config and value != vision_config[key] and key not in ["transformers_version"]:
																																			# If specified in `vision_config_dict`
																																			if key in vision_config_dict:
																																										snake_case_          =						(
																																										    F"""`{key}` is found in both `vision_config_dict` and `vision_config` but with different """
																																										    F"""values. The value `vision_config_dict[\"{key}\"]` will be used instead."""
																																										)
																																			# If inferred from default argument values (just to be super careful)
																																			else:
																																										snake_case_          =						(
																																										    F"""`vision_config_dict` is provided which will be used to initialize `AltCLIPVisionConfig`. """
																																										    F"""The value `vision_config[\"{key}\"]` will be overriden."""
																																										)
																																			logger.warning(UpperCAmelCase_    )

            # Update all values in `vision_config` with the ones in `_vision_config_dict`.
																					vision_config.update(_vision_config_dict    )

														if text_config is None:
																					snake_case_          =						{}
																					logger.info("""`text_config` is `None`. Initializing the `AltCLIPTextConfig` with default values."""    )

														if vision_config is None:
																					snake_case_          =						{}
																					logger.info("""`vision_config` is `None`. initializing the `AltCLIPVisionConfig` with default values."""    )

														snake_case_          =						AltCLIPTextConfig(**UpperCAmelCase_    )
														snake_case_          =						AltCLIPVisionConfig(**UpperCAmelCase_    )

														snake_case_          =						projection_dim
														snake_case_          =						logit_scale_init_value
														snake_case_          =						1.0



							@classmethod
							def 						lowerCAmelCase    (			cls							: List[Any]						,    UpperCAmelCase_							: AltCLIPTextConfig						,    UpperCAmelCase_							: AltCLIPVisionConfig						,    **UpperCAmelCase_							: Optional[int]    )   ->Tuple:



														"""simple docstring"""



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



							def 						lowerCAmelCase    (			self							: Tuple    )   ->int:



														"""simple docstring"""



														snake_case_          =						copy.deepcopy(self.__dict__    )
														snake_case_          =						self.text_config.to_dict()
														snake_case_          =						self.vision_config.to_dict()
														snake_case_          =						self.__class__.model_type
														return output







"""simple docstring"""
from collections import defaultdict
from math import gcd







def   _a			( _SCREAMING_SNAKE_CASE = 1_500_000			)      ->			int:
							snake_case_          =						defaultdict(_SCREAMING_SNAKE_CASE			)
							snake_case_          =						2
							while 2 * euclid_m * (euclid_m + 1) <= limit:
														for euclid_n in range((euclid_m % 2) + 1			,	_SCREAMING_SNAKE_CASE			,	2			):
																					if gcd(_SCREAMING_SNAKE_CASE			,	_SCREAMING_SNAKE_CASE			) > 1:
																												continue
																					snake_case_          =						2 * euclid_m * (euclid_m + euclid_n)
																					for perimeter in range(_SCREAMING_SNAKE_CASE			,	limit + 1			,	_SCREAMING_SNAKE_CASE			):
																												frequencies[perimeter] += 1
														euclid_m += 1
							return sum(1 for frequency in frequencies.values() if frequency == 1			)


if __name__ == "__main__":
				print(f"""{solution() = }""")



