

'''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     lowercase_			(__A   ):




  """simple docstring"""




  SCREAMING_SNAKE_CASE					:						Tuple           =    """git_vision_model"""






  def __init__(   self     :  Dict      ,lowercase__     :  Optional[Any]=7_6_8      ,lowercase__     :  Tuple=3_0_7_2      ,lowercase__     :  Optional[int]=1_2      ,lowercase__     :  Optional[int]=1_2      ,lowercase__     :  Optional[int]=3      ,lowercase__     :  Any=2_2_4      ,lowercase__     :  List[Any]=1_6      ,lowercase__     :  Any="quick_gelu"      ,lowercase__     :  Any=1e-5      ,lowercase__     :  List[Any]=0.0      ,lowercase__     :  int=0.0_2      ,**lowercase__     :  Tuple      ,):
   super().__init__(**UpperCamelCase__    )

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






  @classmethod
  def       SCREAMING_SNAKE_CASE   (   cls     :  int      ,lowercase__     :  Optional[int]      ,**lowercase__     :  List[Any]    ):
   cls._set_token_in_kwargs(UpperCamelCase__    )

   __lowercase													=				cls.get_config_dict(UpperCamelCase__      ,**UpperCamelCase__    )

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




  """simple docstring"""




  SCREAMING_SNAKE_CASE					:						List[str]           =    """git"""






  def __init__(   self     :  Optional[Any]      ,lowercase__     :  List[str]=None      ,lowercase__     :  Optional[Any]=3_0_5_2_2      ,lowercase__     :  Tuple=7_6_8      ,lowercase__     :  Tuple=6      ,lowercase__     :  Tuple=1_2      ,lowercase__     :  List[str]=3_0_7_2      ,lowercase__     :  Union[str, Any]="gelu"      ,lowercase__     :  int=0.1      ,lowercase__     :  List[str]=0.1      ,lowercase__     :  int=1_0_2_4      ,lowercase__     :  Any=0.0_2      ,lowercase__     :  str=1e-1_2      ,lowercase__     :  Dict=0      ,lowercase__     :  Optional[int]="absolute"      ,lowercase__     :  str=True      ,lowercase__     :  str=False      ,lowercase__     :  Union[str, Any]=1_0_1      ,lowercase__     :  List[str]=1_0_2      ,lowercase__     :  Any=None      ,**lowercase__     :  str      ,):
   super().__init__(bos_token_id=UpperCamelCase__      ,eos_token_id=UpperCamelCase__      ,pad_token_id=UpperCamelCase__      ,**UpperCamelCase__    )

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

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

   __lowercase													=				bos_token_id
   __lowercase													=				eos_token_id






  def       SCREAMING_SNAKE_CASE   (   self     :  int    ):
   __lowercase													=				copy.deepcopy(self.__dict__    )
   __lowercase													=				self.vision_config.to_dict()
   __lowercase													=				self.__class__.model_type
   return output




'''simple docstring'''






from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_torch_available,
)


lowerCAmelCase__      		=			{'''configuration_vit_mae''': ['''VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMAEConfig''']}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCAmelCase__      		=			[
     '''VIT_MAE_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''ViTMAEForPreTraining''',
     '''ViTMAELayer''',
     '''ViTMAEModel''',
     '''ViTMAEPreTrainedModel''',
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCAmelCase__      		=			[
     '''TFViTMAEForPreTraining''',
     '''TFViTMAEModel''',
     '''TFViTMAEPreTrainedModel''',
 ]

if TYPE_CHECKING:
 from .configuration_vit_mae import VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP, ViTMAEConfig

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_vit_mae import (
      VIT_MAE_PRETRAINED_MODEL_ARCHIVE_LIST,
      ViTMAEForPreTraining,
      ViTMAELayer,
      ViTMAEModel,
      ViTMAEPreTrainedModel,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_vit_mae import TFViTMAEForPreTraining, TFViTMAEModel, TFViTMAEPreTrainedModel


else:
 import sys

 lowerCAmelCase__      		=			_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)

