






'''simple docstring'''







import copy
import os
from typing import Union

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


__lowerCAmelCase       		=      logging.get_logger(__name__)

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





class 	SCREAMING_SNAKE_CASE					(					SCREAMING_SNAKE_CASE_       ):
			snake_case__  =				"git_vision_model"






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

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







			@classmethod
			def 			SCREAMING_SNAKE_CASE      ( cls      :			int  ,						__SCREAMING_SNAKE_CASE      :			Union[str, os.PathLike]  ,						**__SCREAMING_SNAKE_CASE      :			str					)			->			"PretrainedConfig":
							cls._set_token_in_kwargs(__SCREAMING_SNAKE_CASE					)

							a_				,			a_		:  Optional[int]											=      cls.get_config_dict(__SCREAMING_SNAKE_CASE  ,						**__SCREAMING_SNAKE_CASE					)

							# get the vision config dict if we are loading from GITConfig
							if config_dict.get('''model_type'''					) == "git":
											a_		:  List[str]											=      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(__SCREAMING_SNAKE_CASE  ,						**__SCREAMING_SNAKE_CASE					)





class 	SCREAMING_SNAKE_CASE					(					SCREAMING_SNAKE_CASE_       ):
			snake_case__  =				"git"






			def __init__( self      :			str  ,						__SCREAMING_SNAKE_CASE      :			Any=None  ,						__SCREAMING_SNAKE_CASE      :			Tuple=3_0522  ,						__SCREAMING_SNAKE_CASE      :			List[Any]=768  ,						__SCREAMING_SNAKE_CASE      :			str=6  ,						__SCREAMING_SNAKE_CASE      :			List[str]=12  ,						__SCREAMING_SNAKE_CASE      :			str=3072  ,						__SCREAMING_SNAKE_CASE      :			Optional[int]="gelu"  ,						__SCREAMING_SNAKE_CASE      :			List[Any]=0.1  ,						__SCREAMING_SNAKE_CASE      :			List[str]=0.1  ,						__SCREAMING_SNAKE_CASE      :			List[Any]=1024  ,						__SCREAMING_SNAKE_CASE      :			Optional[int]=0.02  ,						__SCREAMING_SNAKE_CASE      :			str=1e-12  ,						__SCREAMING_SNAKE_CASE      :			Dict=0  ,						__SCREAMING_SNAKE_CASE      :			Any="absolute"  ,						__SCREAMING_SNAKE_CASE      :			int=True  ,						__SCREAMING_SNAKE_CASE      :			Optional[Any]=False  ,						__SCREAMING_SNAKE_CASE      :			Any=101  ,						__SCREAMING_SNAKE_CASE      :			Tuple=102  ,						__SCREAMING_SNAKE_CASE      :			Dict=None  ,						**__SCREAMING_SNAKE_CASE      :			Optional[int]  ,						)			->			Optional[Any]:
							super().__init__(bos_token_id=__SCREAMING_SNAKE_CASE  ,						eos_token_id=__SCREAMING_SNAKE_CASE  ,						pad_token_id=__SCREAMING_SNAKE_CASE  ,						**__SCREAMING_SNAKE_CASE					)

							if vision_config is None:
											a_		:  List[Any]											=      {}
											logger.info('''vision_config is None. initializing the GitVisionConfig with default values.'''					)

							a_		:  str											=      GitVisionConfig(**__SCREAMING_SNAKE_CASE					)
							a_		:  Optional[Any]											=      vocab_size
							a_		:  Any											=      hidden_size
							a_		:  Any											=      num_hidden_layers
							a_		:  int											=      num_attention_heads
							a_		:  List[Any]											=      hidden_act
							a_		:  Dict											=      intermediate_size
							a_		:  Optional[Any]											=      hidden_dropout_prob
							a_		:  Union[str, Any]											=      attention_probs_dropout_prob
							a_		:  Dict											=      max_position_embeddings
							a_		:  Any											=      initializer_range
							a_		:  Optional[int]											=      layer_norm_eps
							a_		:  str											=      position_embedding_type
							a_		:  Union[str, Any]											=      use_cache
							a_		:  Any											=      tie_word_embeddings
							a_		:  str											=      num_image_with_embedding

							a_		:  int											=      bos_token_id
							a_		:  Optional[int]											=      eos_token_id







			def 			SCREAMING_SNAKE_CASE      ( self      :			Optional[int]					)			->			Optional[int]:
							a_		:  List[Any]											=      copy.deepcopy(self.__dict__					)
							a_		:  Tuple											=      self.vision_config.to_dict()
							a_		:  Union[str, Any]											=      self.__class__.model_type
							return output












'''simple docstring'''







import warnings


warnings.warn(
    'memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: '
    '`from accelerate import find_executable_batch_size` to avoid this warning.',
    FutureWarning,
)




