
"""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      _UpperCAmelCase							(		SCREAMING_SNAKE_CASE_							):
      __SCREAMING_SNAKE_CASE   :							Optional[Any]							      =	"git_vision_model"




      def __init__(							self   ,       lowercase_=7_6_8   ,       lowercase_=3_0_7_2   ,       lowercase_=1_2   ,       lowercase_=1_2   ,       lowercase_=3   ,       lowercase_=2_2_4   ,       lowercase_=1_6   ,       lowercase_="quick_gelu"   ,       lowercase_=1E-5   ,       lowercase_=0.0   ,       lowercase_=0.0_2   ,       **lowercase_   ,       )						->					Any:
          super().__init__(**lowercase_							)

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




      @classmethod
      def     a_      (							cls   ,       lowercase_   ,       **lowercase_							)						->					"PretrainedConfig":
          cls._set_token_in_kwargs(lowercase_							)

          UpperCAmelCase			,							UpperCAmelCase									=					cls.get_config_dict(lowercase_   ,       **lowercase_							)

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




      def __init__(							self   ,       lowercase_=None   ,       lowercase_=3_0_5_2_2   ,       lowercase_=7_6_8   ,       lowercase_=6   ,       lowercase_=1_2   ,       lowercase_=3_0_7_2   ,       lowercase_="gelu"   ,       lowercase_=0.1   ,       lowercase_=0.1   ,       lowercase_=1_0_2_4   ,       lowercase_=0.0_2   ,       lowercase_=1E-12   ,       lowercase_=0   ,       lowercase_="absolute"   ,       lowercase_=True   ,       lowercase_=False   ,       lowercase_=1_0_1   ,       lowercase_=1_0_2   ,       lowercase_=None   ,       **lowercase_   ,       )						->					Optional[int]:
          super().__init__(bos_token_id=lowercase_   ,       eos_token_id=lowercase_   ,       pad_token_id=lowercase_   ,       **lowercase_							)

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

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

          UpperCAmelCase									=					bos_token_id
          UpperCAmelCase									=					eos_token_id




      def     a_      (							self							)						->					Any:
          UpperCAmelCase									=					copy.deepcopy(self.__dict__							)
          UpperCAmelCase									=					self.vision_config.to_dict()
          UpperCAmelCase									=					self.__class__.model_type
          return output





"""simple docstring"""

import copy

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


SCREAMING_SNAKE_CASE_    					=						logging.get_logger(__name__)
class      _UpperCAmelCase							(		SCREAMING_SNAKE_CASE_							):
      __SCREAMING_SNAKE_CASE   :							Union[str, Any]							      =	"encoder-decoder"
      __SCREAMING_SNAKE_CASE   :							Any							      =	True




      def __init__(							self   ,       **lowercase_							)						->					str:
          super().__init__(**lowercase_							)
          assert (
              "encoder" in kwargs and "decoder" in kwargs
          ), "Config has to be initialized with encoder and decoder config"
          UpperCAmelCase									=					kwargs.pop('encoder'							)
          UpperCAmelCase									=					encoder_config.pop('model_type'							)
          UpperCAmelCase									=					kwargs.pop('decoder'							)
          UpperCAmelCase									=					decoder_config.pop('model_type'							)

          from ..auto.configuration_auto import AutoConfig

          UpperCAmelCase									=					AutoConfig.for_model(lowercase_   ,       **lowercase_							)
          UpperCAmelCase									=					AutoConfig.for_model(lowercase_   ,       **lowercase_							)
          UpperCAmelCase									=					True




      @classmethod
      def     a_      (							cls   ,       lowercase_   ,       lowercase_   ,       **lowercase_							)						->					PretrainedConfig:
          logger.info('Set `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config'							)
          UpperCAmelCase									=					True
          UpperCAmelCase									=					True

          return cls(encoder=encoder_config.to_dict()   ,       decoder=decoder_config.to_dict()   ,       **lowercase_							)




      def     a_      (							self							)						->					Optional[int]:
          UpperCAmelCase									=					copy.deepcopy(self.__dict__							)
          UpperCAmelCase									=					self.encoder.to_dict()
          UpperCAmelCase									=					self.decoder.to_dict()
          UpperCAmelCase									=					self.__class__.model_type
          return output



