'''simple docstring'''






import copy
import os
from typing import Union

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


SCREAMING_SNAKE_CASE_	   =			logging.get_logger(__name__)

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




class    a (       __lowerCamelCase				):



		"""simple docstring"""
		__lowerCAmelCase				      =					'''git_vision_model'''







		def __init__(							self   ,    snake_case_=768   ,    snake_case_=3072   ,    snake_case_=12   ,    snake_case_=12   ,    snake_case_=3   ,    snake_case_=224   ,    snake_case_=16   ,    snake_case_="quick_gelu"   ,    snake_case_=1e-5   ,    snake_case_=0.0   ,    snake_case_=0.0_2   ,    **snake_case_   ,    ):

				'''simple docstring'''







				super().__init__(**a_					)

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







		@classmethod
		def    lowercase_  (							cls   ,    snake_case_   ,    **snake_case_					):

				'''simple docstring'''







				cls._set_token_in_kwargs(a_					)

				__UpperCAmelCase:					List[Any]		= cls.get_config_dict(a_   ,    **a_					)

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



		"""simple docstring"""
		__lowerCAmelCase				      =					'''git'''







		def __init__(							self   ,    snake_case_=None   ,    snake_case_=3_0522   ,    snake_case_=768   ,    snake_case_=6   ,    snake_case_=12   ,    snake_case_=3072   ,    snake_case_="gelu"   ,    snake_case_=0.1   ,    snake_case_=0.1   ,    snake_case_=1024   ,    snake_case_=0.0_2   ,    snake_case_=1e-1_2   ,    snake_case_=0   ,    snake_case_="absolute"   ,    snake_case_=True   ,    snake_case_=False   ,    snake_case_=101   ,    snake_case_=102   ,    snake_case_=None   ,    **snake_case_   ,    ):

				'''simple docstring'''







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

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

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

				__UpperCAmelCase:					List[Any]		= bos_token_id
				__UpperCAmelCase:					Optional[Any]		= eos_token_id







		def    lowercase_  (							self					):

				'''simple docstring'''







				__UpperCAmelCase:					Union[str, Any]		= copy.deepcopy(self.__dict__					)
				__UpperCAmelCase:					str		= self.vision_config.to_dict()
				__UpperCAmelCase:					Optional[int]		= 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_tokenizers_available,
    is_torch_available,
)


SCREAMING_SNAKE_CASE_	   =			{
    'configuration_electra': ['ELECTRA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ElectraConfig', 'ElectraOnnxConfig'],
    'tokenization_electra': ['ElectraTokenizer'],
}

try:
    if not is_tokenizers_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    SCREAMING_SNAKE_CASE_	   =			['ElectraTokenizerFast']

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    SCREAMING_SNAKE_CASE_	   =			[
        'ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST',
        'ElectraForCausalLM',
        'ElectraForMaskedLM',
        'ElectraForMultipleChoice',
        'ElectraForPreTraining',
        'ElectraForQuestionAnswering',
        'ElectraForSequenceClassification',
        'ElectraForTokenClassification',
        'ElectraModel',
        'ElectraPreTrainedModel',
        'load_tf_weights_in_electra',
    ]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    SCREAMING_SNAKE_CASE_	   =			[
        'TF_ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST',
        'TFElectraForMaskedLM',
        'TFElectraForMultipleChoice',
        'TFElectraForPreTraining',
        'TFElectraForQuestionAnswering',
        'TFElectraForSequenceClassification',
        'TFElectraForTokenClassification',
        'TFElectraModel',
        'TFElectraPreTrainedModel',
    ]

try:
    if not is_flax_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    SCREAMING_SNAKE_CASE_	   =			[
        'FlaxElectraForCausalLM',
        'FlaxElectraForMaskedLM',
        'FlaxElectraForMultipleChoice',
        'FlaxElectraForPreTraining',
        'FlaxElectraForQuestionAnswering',
        'FlaxElectraForSequenceClassification',
        'FlaxElectraForTokenClassification',
        'FlaxElectraModel',
        'FlaxElectraPreTrainedModel',
    ]


if TYPE_CHECKING:
    from .configuration_electra import ELECTRA_PRETRAINED_CONFIG_ARCHIVE_MAP, ElectraConfig, ElectraOnnxConfig
    from .tokenization_electra import ElectraTokenizer

    try:
        if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_electra_fast import ElectraTokenizerFast

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_electra import (
            ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST,
            ElectraForCausalLM,
            ElectraForMaskedLM,
            ElectraForMultipleChoice,
            ElectraForPreTraining,
            ElectraForQuestionAnswering,
            ElectraForSequenceClassification,
            ElectraForTokenClassification,
            ElectraModel,
            ElectraPreTrainedModel,
            load_tf_weights_in_electra,
        )

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_electra import (
            TF_ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST,
            TFElectraForMaskedLM,
            TFElectraForMultipleChoice,
            TFElectraForPreTraining,
            TFElectraForQuestionAnswering,
            TFElectraForSequenceClassification,
            TFElectraForTokenClassification,
            TFElectraModel,
            TFElectraPreTrainedModel,
        )

    try:
        if not is_flax_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_flax_electra import (
            FlaxElectraForCausalLM,
            FlaxElectraForMaskedLM,
            FlaxElectraForMultipleChoice,
            FlaxElectraForPreTraining,
            FlaxElectraForQuestionAnswering,
            FlaxElectraForSequenceClassification,
            FlaxElectraForTokenClassification,
            FlaxElectraModel,
            FlaxElectraPreTrainedModel,
        )

else:
    import sys

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