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     a_			(						SCREAMING_SNAKE_CASE						):






 '''simple docstring'''






 UpperCAmelCase_     			= 'git_vision_model'




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







        '''simple docstring'''



        super().__init__(**lowercase__)

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




 @classmethod
 def 		__snake_case						(      cls :  Any      ,   lowercase__ :  Union[str, os.PathLike]      ,   **lowercase__ :  Optional[Any]):







        '''simple docstring'''



        cls._set_token_in_kwargs(lowercase__)

        lowerCAmelCase__     , lowerCAmelCase__					     = cls.get_config_dict(lowercase__      ,   **lowercase__)

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






class     a_			(						SCREAMING_SNAKE_CASE						):






 '''simple docstring'''






 UpperCAmelCase_     			= 'git'




 def __init__(      self :  Any      ,   lowercase__ :  Optional[int]=None      ,   lowercase__ :  Dict=30_522      ,   lowercase__ :  List[Any]=768      ,   lowercase__ :  Optional[Any]=6      ,   lowercase__ :  List[Any]=12      ,   lowercase__ :  Any=3_072      ,   lowercase__ :  Any="gelu"      ,   lowercase__ :  int=0.1      ,   lowercase__ :  Optional[int]=0.1      ,   lowercase__ :  Union[str, Any]=1_024      ,   lowercase__ :  int=0.02      ,   lowercase__ :  Dict=1e-12      ,   lowercase__ :  List[str]=0      ,   lowercase__ :  List[str]="absolute"      ,   lowercase__ :  Optional[Any]=True      ,   lowercase__ :  Optional[int]=False      ,   lowercase__ :  Optional[Any]=101      ,   lowercase__ :  Any=102      ,   lowercase__ :  int=None      ,   **lowercase__ :  Optional[int]      ,   ):







        '''simple docstring'''



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

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

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

        lowerCAmelCase__					     = bos_token_id
        lowerCAmelCase__					     = eos_token_id




 def 		__snake_case						(      self :  str):







        '''simple docstring'''



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

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowerCAmelCase__     						=			{
    'configuration_x_clip': [
        'XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'XCLIPConfig',
        'XCLIPTextConfig',
        'XCLIPVisionConfig',
    ],
    'processing_x_clip': ['XCLIPProcessor'],
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCAmelCase__     						=			[
        'XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST',
        'XCLIPModel',
        'XCLIPPreTrainedModel',
        'XCLIPTextModel',
        'XCLIPVisionModel',
    ]

if TYPE_CHECKING:
    from .configuration_x_clip import (
        XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
        XCLIPConfig,
        XCLIPTextConfig,
        XCLIPVisionConfig,
    )
    from .processing_x_clip import XCLIPProcessor

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_x_clip import (
            XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
            XCLIPModel,
            XCLIPPreTrainedModel,
            XCLIPTextModel,
            XCLIPVisionModel,
        )

else:
    import sys

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