





'''simple docstring'''

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 __a			( _snake_case      ):
   __UpperCamelCase :			int						   =						'git_vision_model'





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

      '''simple docstring'''

      super().__init__(**lowerCamelCase     )

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





   @classmethod
   def   UpperCAmelCase__  (       cls					:      Optional[Any]					,lowerCamelCase					:      Union[str, os.PathLike]					,**lowerCamelCase					:      Tuple     ):

      '''simple docstring'''

      cls._set_token_in_kwargs(lowerCamelCase     )

      __SCREAMING_SNAKE_CASE				,  __SCREAMING_SNAKE_CASE   				=							cls.get_config_dict(lowerCamelCase					,**lowerCamelCase     )

      # get the vision config dict if we are loading from GITConfig
      if config_dict.get("""model_type"""     ) == "git":
         __SCREAMING_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(lowerCamelCase					,**lowerCamelCase     )







class __a			( _snake_case      ):
   __UpperCamelCase :			str						   =						'git'





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

      '''simple docstring'''

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

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

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

      __SCREAMING_SNAKE_CASE   				=							bos_token_id
      __SCREAMING_SNAKE_CASE   				=							eos_token_id





   def   UpperCAmelCase__  (       self					:      Union[str, Any]     ):

      '''simple docstring'''

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







'''simple docstring'''
from typing import TYPE_CHECKING

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


lowerCAmelCase					:    Optional[Any]           = {
    'configuration_falcon': ['FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FalconConfig'],
}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCAmelCase					:    str           = [
						    'FALCON_PRETRAINED_MODEL_ARCHIVE_LIST',
						    'FalconForCausalLM',
						    'FalconModel',
						    'FalconPreTrainedModel',
						    'FalconForSequenceClassification',
						    'FalconForTokenClassification',
						    'FalconForQuestionAnswering',
						]


if TYPE_CHECKING:
						from .configuration_falcon import FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP, FalconConfig

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_falcon import (
												    FALCON_PRETRAINED_MODEL_ARCHIVE_LIST,
												    FalconForCausalLM,
												    FalconForQuestionAnswering,
												    FalconForSequenceClassification,
												    FalconForTokenClassification,
												    FalconModel,
												    FalconPreTrainedModel,
												)


else:
						import sys

						lowerCAmelCase					:    Tuple           = _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)




