






import copy
import os
from typing import Union

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


lowerCamelCase       :       Optional[int]        =				logging.get_logger(__name__)

lowerCamelCase       :       Dict        =				{
    '''microsoft/git-base''': '''https://huggingface.co/microsoft/git-base/resolve/main/config.json''',
}

class 						lowerCAmelCase   (       __a	):

					'''simple docstring'''

					_A  :	Optional[int]     =					'''git_vision_model'''



					def __init__(     self :		Dict						,   __a :		Tuple=768						,   __a :		str=3072						,   __a :		Any=12						,   __a :		Dict=12						,   __a :		Optional[int]=3						,   __a :		List[str]=224						,   __a :		Optional[int]=16						,   __a :		Optional[int]="quick_gelu"						,   __a :		Any=1E-5						,   __a :		Optional[Any]=0.0						,   __a :		Optional[Any]=0.02						,   **__a :		List[str]						,   )	->     List[Any]:


												"""simple docstring"""

												super().__init__(**__a							)

												__lowercase					:							List[Any]			=   hidden_size
												__lowercase					:							List[str]			=   intermediate_size
												__lowercase					:							List[str]			=   num_hidden_layers
												__lowercase					:							Optional[Any]			=   num_attention_heads
												__lowercase					:							Union[str, Any]			=   num_channels
												__lowercase					:							List[Any]			=   patch_size
												__lowercase					:							Optional[Any]			=   image_size
												__lowercase					:							Optional[int]			=   initializer_range
												__lowercase					:							Any			=   attention_dropout
												__lowercase					:							Dict			=   layer_norm_eps
												__lowercase					:							Optional[int]			=   hidden_act



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


												"""simple docstring"""

												cls._set_token_in_kwargs(__a							)

												__lowercase	,	__lowercase					:							int			=   cls.get_config_dict(__a						,   **__a							)

												# get the vision config dict if we are loading from GITConfig
												if config_dict.get("""model_type"""							) == "git":
																			__lowercase					:							Dict			=   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  :	Any     =					'''git'''



					def __init__(     self :		int						,   __a :		Union[str, Any]=None						,   __a :		Dict=30522						,   __a :		Optional[int]=768						,   __a :		Dict=6						,   __a :		Optional[Any]=12						,   __a :		List[str]=3072						,   __a :		List[str]="gelu"						,   __a :		List[Any]=0.1						,   __a :		Any=0.1						,   __a :		int=1024						,   __a :		str=0.02						,   __a :		Union[str, Any]=1E-12						,   __a :		Any=0						,   __a :		List[str]="absolute"						,   __a :		List[str]=True						,   __a :		Optional[int]=False						,   __a :		Tuple=101						,   __a :		Tuple=102						,   __a :		str=None						,   **__a :		Dict						,   )	->     Tuple:


												"""simple docstring"""

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

												if vision_config is None:
																			__lowercase					:							Optional[Any]			=   {}
																			logger.info("""vision_config is None. initializing the GitVisionConfig with default values."""							)

												__lowercase					:							Optional[int]			=   GitVisionConfig(**__a							)
												__lowercase					:							Optional[Any]			=   vocab_size
												__lowercase					:							str			=   hidden_size
												__lowercase					:							Tuple			=   num_hidden_layers
												__lowercase					:							List[str]			=   num_attention_heads
												__lowercase					:							List[Any]			=   hidden_act
												__lowercase					:							Optional[int]			=   intermediate_size
												__lowercase					:							Optional[Any]			=   hidden_dropout_prob
												__lowercase					:							Optional[Any]			=   attention_probs_dropout_prob
												__lowercase					:							List[str]			=   max_position_embeddings
												__lowercase					:							List[str]			=   initializer_range
												__lowercase					:							List[str]			=   layer_norm_eps
												__lowercase					:							Optional[Any]			=   position_embedding_type
												__lowercase					:							Optional[int]			=   use_cache
												__lowercase					:							Any			=   tie_word_embeddings
												__lowercase					:							List[str]			=   num_image_with_embedding

												__lowercase					:							List[str]			=   bos_token_id
												__lowercase					:							Dict			=   eos_token_id



					def 					lowerCAmelCase (     self :		Any							)	->     Tuple:


												"""simple docstring"""

												__lowercase					:							Dict			=   copy.deepcopy(self.__dict__							)
												__lowercase					:							Optional[Any]			=   self.vision_config.to_dict()
												__lowercase					:							str			=   self.__class__.model_type
												return output







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


lowerCamelCase       :       Optional[Any]        =				logging.get_logger(__name__)

lowerCamelCase       :       List[str]        =				{
    '''google/canine-s''': '''https://huggingface.co/google/canine-s/resolve/main/config.json''',
    # See all CANINE models at https://huggingface.co/models?filter=canine
}

class 						lowerCAmelCase   (       __a	):

					'''simple docstring'''

					_A  :	List[Any]     =					'''canine'''



					def __init__(     self :		List[str]						,   __a :		Optional[int]=768						,   __a :		Any=12						,   __a :		Any=12						,   __a :		Dict=3072						,   __a :		Dict="gelu"						,   __a :		List[Any]=0.1						,   __a :		List[Any]=0.1						,   __a :		Tuple=16384						,   __a :		List[Any]=16						,   __a :		List[Any]=0.02						,   __a :		Optional[Any]=1E-12						,   __a :		Dict=0						,   __a :		List[Any]=0xe_0_0_0						,   __a :		Optional[int]=0xe_0_0_1						,   __a :		Any=4						,   __a :		Dict=4						,   __a :		Optional[int]=8						,   __a :		Any=16384						,   __a :		Optional[Any]=128						,   **__a :		List[str]						,   )	->     Union[str, Any]:


												"""simple docstring"""

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

												__lowercase					:							int			=   max_position_embeddings
												__lowercase					:							List[str]			=   hidden_size
												__lowercase					:							List[Any]			=   num_hidden_layers
												__lowercase					:							Dict			=   num_attention_heads
												__lowercase					:							int			=   intermediate_size
												__lowercase					:							Dict			=   hidden_act
												__lowercase					:							Tuple			=   hidden_dropout_prob
												__lowercase					:							Union[str, Any]			=   attention_probs_dropout_prob
												__lowercase					:							Union[str, Any]			=   initializer_range
												__lowercase					:							Any			=   type_vocab_size
												__lowercase					:							int			=   layer_norm_eps

												# Character config:
												__lowercase					:							int			=   downsampling_rate
												__lowercase					:							str			=   upsampling_kernel_size
												__lowercase					:							Union[str, Any]			=   num_hash_functions
												__lowercase					:							Optional[Any]			=   num_hash_buckets
												__lowercase					:							Optional[int]			=   local_transformer_stride