

import copy
import os
from typing import Union

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


A__						=							logging.get_logger(__name__)

A__						=							{
    "microsoft/git-base": "https://huggingface.co/microsoft/git-base/resolve/main/config.json",
}

class 				__UpperCamelCase				(					SCREAMING_SNAKE_CASE			):
	_lowercase  :   Tuple       				=  "git_vision_model"







	def __init__(   self: int  , __UpperCamelCase: Dict=7_68  , __UpperCamelCase: Optional[Any]=30_72  , __UpperCamelCase: Any=12  , __UpperCamelCase: Union[str, Any]=12  , __UpperCamelCase: Optional[int]=3  , __UpperCamelCase: str=2_24  , __UpperCamelCase: int=16  , __UpperCamelCase: Optional[Any]="quick_gelu"  , __UpperCamelCase: Union[str, Any]=1E-5  , __UpperCamelCase: Dict=0.0  , __UpperCamelCase: List[Any]=0.02  , **__UpperCamelCase: List[str]  , ):

						'''simple docstring'''





						super().__init__(**__UpperCamelCase      )

						__magic_name__							=    hidden_size
						__magic_name__							=    intermediate_size
						__magic_name__							=    num_hidden_layers
						__magic_name__							=    num_attention_heads
						__magic_name__							=    num_channels
						__magic_name__							=    patch_size
						__magic_name__							=    image_size
						__magic_name__							=    initializer_range
						__magic_name__							=    attention_dropout
						__magic_name__							=    layer_norm_eps
						__magic_name__							=    hidden_act







	@classmethod
	def 	_SCREAMING_SNAKE_CASE							(   cls: Union[str, Any]  , __UpperCamelCase: Union[str, os.PathLike]  , **__UpperCamelCase: str      ):

						'''simple docstring'''





						cls._set_token_in_kwargs(__UpperCamelCase      )

						__magic_name__,	__magic_name__							=    cls.get_config_dict(__UpperCamelCase  , **__UpperCamelCase      )

						# get the vision config dict if we are loading from GITConfig
						if config_dict.get('model_type'      ) == "git":
											__magic_name__							=    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 				__UpperCamelCase				(					SCREAMING_SNAKE_CASE			):
	_lowercase  :   str       				=  "git"







	def __init__(   self: str  , __UpperCamelCase: Union[str, Any]=None  , __UpperCamelCase: Union[str, Any]=3_05_22  , __UpperCamelCase: Optional[int]=7_68  , __UpperCamelCase: Any=6  , __UpperCamelCase: Optional[int]=12  , __UpperCamelCase: str=30_72  , __UpperCamelCase: Optional[int]="gelu"  , __UpperCamelCase: int=0.1  , __UpperCamelCase: int=0.1  , __UpperCamelCase: List[Any]=10_24  , __UpperCamelCase: Optional[Any]=0.02  , __UpperCamelCase: Any=1E-12  , __UpperCamelCase: Tuple=0  , __UpperCamelCase: List[str]="absolute"  , __UpperCamelCase: List[Any]=True  , __UpperCamelCase: Optional[int]=False  , __UpperCamelCase: Dict=1_01  , __UpperCamelCase: int=1_02  , __UpperCamelCase: str=None  , **__UpperCamelCase: Any  , ):

						'''simple docstring'''





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

						if vision_config is None:
											__magic_name__							=    {}
											logger.info('vision_config is None. initializing the GitVisionConfig with default values.'      )

						__magic_name__							=    GitVisionConfig(**__UpperCamelCase      )
						__magic_name__							=    vocab_size
						__magic_name__							=    hidden_size
						__magic_name__							=    num_hidden_layers
						__magic_name__							=    num_attention_heads
						__magic_name__							=    hidden_act
						__magic_name__							=    intermediate_size
						__magic_name__							=    hidden_dropout_prob
						__magic_name__							=    attention_probs_dropout_prob
						__magic_name__							=    max_position_embeddings
						__magic_name__							=    initializer_range
						__magic_name__							=    layer_norm_eps
						__magic_name__							=    position_embedding_type
						__magic_name__							=    use_cache
						__magic_name__							=    tie_word_embeddings
						__magic_name__							=    num_image_with_embedding

						__magic_name__							=    bos_token_id
						__magic_name__							=    eos_token_id







	def 	_SCREAMING_SNAKE_CASE							(   self: int      ):

						'''simple docstring'''





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







from __future__ import annotations




def 					_lowercase     (				a_				:					int				)				->	bool:




					'''simple docstring'''







					__magic_name__							=    str(a_				)
					return len(a_				) == 9 and set(a_				) == set('123456789'				)




def 					_lowercase     (				)				->	int | None:




					'''simple docstring'''







					for base_num in range(9_9_9_9					,4_9_9_9					,-1				):
										__magic_name__							=    1_0_0_0_0_2 * base_num
										if is_9_pandigital(a_				):
															return candidate

					for base_num in range(3_3_3					,9_9					,-1				):
										__magic_name__							=    1_0_0_2_0_0_3 * base_num
										if is_9_pandigital(a_				):
															return candidate

					return None


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




