






'''simple docstring'''



import collections.abc
from typing import Optional, Tuple, Union

import torch
import torch.utils.checkpoint
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss

from ...activations import ACTaFN
from ...modeling_outputs import BaseModelOutputWithNoAttention, ImageClassifierOutputWithNoAttention
from ...modeling_utils import PreTrainedModel
from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging
from .configuration_poolformer import PoolFormerConfig


SCREAMING_SNAKE_CASE							=						logging.get_logger(__name__)

# General docstring
SCREAMING_SNAKE_CASE							=						'PoolFormerConfig'

# Base docstring
SCREAMING_SNAKE_CASE							=						'sail/poolformer_s12'
SCREAMING_SNAKE_CASE							=						[1, 512, 7, 7]

# Image classification docstring
SCREAMING_SNAKE_CASE							=						'sail/poolformer_s12'
SCREAMING_SNAKE_CASE							=						'tabby, tabby cat'

SCREAMING_SNAKE_CASE							=						[
    'sail/poolformer_s12',
    # See all PoolFormer models at https://huggingface.co/models?filter=poolformer
]


def 				lowercase_					(     __A			:							Optional[Any]       ,   __A			:							float = 0.0       ,   __A			:							bool = False      )							->   Tuple:



 """simple docstring"""




 if drop_prob == 0.0 or not training:
  return input
 lowercase       : str						=1 - drop_prob
 lowercase       : int						=(input.shape[0],) + (1,) * (input.ndim - 1)  # work with diff dim tensors, not just 2D ConvNets
 lowercase       : int						=keep_prob + torch.rand(__A       ,   dtype=input.dtype       ,   device=input.device      )
 random_tensor.floor_()  # binarize
 lowercase       : int						=input.div(__A      ) * random_tensor
 return output
class UpperCAmelCase_       (     nn.Module					):




      """simple docstring"""




      def __init__(			self      :		Dict  ,   UpperCAmelCase      :		Optional[float] = None		)	->	None:


       '''simple docstring'''

       super().__init__()
       lowercase       : Optional[Any]						=drop_prob






      def 					A__   (			self      :		Optional[Any]  ,   UpperCAmelCase      :		torch.Tensor		)	->	torch.Tensor:


       '''simple docstring'''

       return drop_path(UpperCAmelCase  ,   self.drop_prob  ,   self.training		)






      def 					A__   (			self      :		List[Any]		)	->	str:


       '''simple docstring'''

       return "p={}".format(self.drop_prob		)





class UpperCAmelCase_       (     nn.Module					):




      """simple docstring"""




      def __init__(			self      :		Tuple  ,   UpperCAmelCase      :		Union[str, Any]  ,   UpperCAmelCase      :		Optional[int]  ,   UpperCAmelCase      :		int  ,   UpperCAmelCase      :		Union[str, Any]  ,   UpperCAmelCase      :		Optional[Any]  ,   UpperCAmelCase      :		Union[str, Any]=None		)	->	Union[str, Any]:


       '''simple docstring'''

       super().__init__()
       lowercase       : Union[str, Any]						=patch_size if isinstance(UpperCAmelCase  ,   collections.abc.Iterable		) else (patch_size, patch_size)
       lowercase       : Optional[Any]						=stride if isinstance(UpperCAmelCase  ,   collections.abc.Iterable		) else (stride, stride)
       lowercase       : Dict						=padding if isinstance(UpperCAmelCase  ,   collections.abc.Iterable		) else (padding, padding)

       lowercase       : Tuple						=nn.Convad(UpperCAmelCase  ,   UpperCAmelCase  ,   kernel_size=UpperCAmelCase  ,   stride=UpperCAmelCase  ,   padding=UpperCAmelCase		)
       lowercase       : Tuple						=norm_layer(UpperCAmelCase		) if norm_layer else nn.Identity()






      def 					A__   (			self      :		Union[str, Any]  ,   UpperCAmelCase      :		List[Any]		)	->	int:


       '''simple docstring'''

       lowercase       : Optional[Any]						=self.projection(UpperCAmelCase		)
       lowercase       : Dict						=self.norm(UpperCAmelCase		)
       return embeddings





class UpperCAmelCase_       (     nn.GroupNorm					):




      """simple docstring"""




      def __init__(			self      :		int  ,   UpperCAmelCase      :		List[str]  ,   **UpperCAmelCase      :		int		)	->	List[Any]:


       '''simple docstring'''

       super().__init__(1  ,   UpperCAmelCase  ,   **UpperCAmelCase		)





class UpperCAmelCase_       (     nn.Module					):




      """simple docstring"""




      def __init__(			self      :		List[str]  ,   UpperCAmelCase      :		List[str]		)	->	Tuple:


       '''simple docstring'''

       super().__init__()
       lowercase       : Optional[Any]						=nn.AvgPoolad(UpperCAmelCase  ,   stride=1  ,   padding=pool_size // 2  ,   count_include_pad=UpperCAmelCase		)






      def 					A__   (			self      :		Union[str, Any]  ,   UpperCAmelCase      :		Optional[Any]		)	->	int:


       '''simple docstring'''

       return self.pool(UpperCAmelCase		) - hidden_states





class UpperCAmelCase_       (     nn.Module					):




      """simple docstring"""




      def __init__(			self      :		Union[str, Any]  ,   UpperCAmelCase      :		Union[str, Any]  ,   UpperCAmelCase      :		List[str]  ,   UpperCAmelCase      :		List[Any]  ,   UpperCAmelCase      :		List[str]		)	->	Optional[Any]:


       '''simple docstring'''

       super().__init__()
       lowercase       : List[str]						=nn.Convad(UpperCAmelCase  ,   UpperCAmelCase  ,   1		)
       lowercase       : List[str]						=nn.Convad(UpperCAmelCase  ,   UpperCAmelCase  ,   1		)
       lowercase       : int						=PoolFormerDropPath(UpperCAmelCase		)
       if isinstance(config.hidden_act  ,   UpperCAmelCase		):
        lowercase       : List[str]						=ACTaFN[config.hidden_act]
       else:
        lowercase       : str						=config.hidden_act






      def 					A__   (			self      :		str  ,   UpperCAmelCase      :		Optional[int]		)	->	Tuple:


       '''simple docstring'''

       lowercase       : int						=self.conva(UpperCAmelCase		)
       lowercase       : str						=self.act_fn(UpperCAmelCase		)
       lowercase       : str						=self.drop(UpperCAmelCase		)
       lowercase       : Optional[int]						=self.conva(UpperCAmelCase		)
       lowercase       : List[str]						=self.drop(UpperCAmelCase		)

       return hidden_states





class UpperCAmelCase_       (     nn.Module					):




      """simple docstring"""




      def __init__(			self      :		List[str]  ,   UpperCAmelCase      :		Union[str, Any]  ,   UpperCAmelCase      :		str  ,   UpperCAmelCase      :		List[Any]  ,   UpperCAmelCase      :		Optional[Any]  ,   UpperCAmelCase      :		Optional[Any]  ,   UpperCAmelCase      :		int		)	->	str:


       '''simple docstring'''

       super().__init__()
       lowercase       : Tuple						=PoolFormerPooling(UpperCAmelCase		)
       lowercase       : Dict						=PoolFormerOutput(UpperCAmelCase  ,   UpperCAmelCase  ,   UpperCAmelCase  ,   UpperCAmelCase		)
       lowercase       : Optional[Any]						=PoolFormerGroupNorm(UpperCAmelCase		)
       lowercase       : Union[str, Any]						=PoolFormerGroupNorm(UpperCAmelCase		)

       # Useful for training neural nets
       lowercase       : Dict						=PoolFormerDropPath(UpperCAmelCase		) if drop_path > 0.0 else nn.Identity()
       lowercase       : Any						=config.use_layer_scale
       if config.use_layer_scale:
        lowercase       : Dict						=nn.Parameter(
            config.layer_scale_init_value * torch.ones((UpperCAmelCase)		)  ,   requires_grad=UpperCAmelCase		)
        lowercase       : Dict						=nn.Parameter(
            config.layer_scale_init_value * torch.ones((UpperCAmelCase)		)  ,   requires_grad=UpperCAmelCase		)






      def 					A__   (			self      :		Tuple  ,   UpperCAmelCase      :		str		)	->	int:


       '''simple docstring'''

       if self.use_layer_scale:
        lowercase       : Dict						=self.pooling(self.before_norm(UpperCAmelCase		)		)
        lowercase       : Any						=self.layer_scale_a.unsqueeze(-1		).unsqueeze(-1		) * pooling_output
        # First residual connection
        lowercase       : int						=hidden_states + self.drop_path(UpperCAmelCase		)
        lowercase       : Optional[Any]						=()

        lowercase       : Optional[Any]						=self.output(self.after_norm(UpperCAmelCase		)		)
        lowercase       : List[str]						=self.layer_scale_a.unsqueeze(-1		).unsqueeze(-1		) * layer_output
        # Second residual connection
        lowercase       : Optional[int]						=hidden_states + self.drop_path(UpperCAmelCase		)

        lowercase       : Dict						=(output,) + outputs
        return outputs

       else:
        lowercase       : List[Any]						=self.drop_path(self.pooling(self.before_norm(UpperCAmelCase		)		)		)
        # First residual connection
        lowercase       : Optional[Any]						=pooling_output + hidden_states
        lowercase       : int						=()

        # Second residual connection inside the PoolFormerOutput block
        lowercase       : Tuple						=self.drop_path(self.output(self.after_norm(UpperCAmelCase		)		)		)
        lowercase       : List[Any]						=hidden_states + layer_output

        lowercase       : Dict						=(output,) + outputs
        return outputs





class UpperCAmelCase_       (     nn.Module					):




      """simple docstring"""




      def __init__(			self      :		Union[str, Any]  ,   UpperCAmelCase      :		Optional[int]		)	->	Tuple:


       '''simple docstring'''

       super().__init__()
       lowercase       : Tuple						=config
       # stochastic depth decay rule
       lowercase       : Optional[Any]						=[x.item() for x in torch.linspace(0  ,   config.drop_path_rate  ,   sum(config.depths		)		)]

       # patch embeddings
       lowercase       : Union[str, Any]						=[]
       for i in range(config.num_encoder_blocks		):
        embeddings.append(
            PoolFormerEmbeddings(
                patch_size=config.patch_sizes[i]  ,   stride=config.strides[i]  ,   padding=config.padding[i]  ,   num_channels=config.num_channels if i == 0 else config.hidden_sizes[i - 1]  ,   hidden_size=config.hidden_sizes[i]  ,   )		)
       lowercase       : Union[str, Any]						=nn.ModuleList(UpperCAmelCase		)

       # Transformer blocks
       lowercase       : Any						=[]
       lowercase       : Any						=0
       for i in range(config.num_encoder_blocks		):
        # each block consists of layers
        lowercase       : Tuple						=[]
        if i != 0:
         cur += config.depths[i - 1]
        for j in range(config.depths[i]		):
         layers.append(
             PoolFormerLayer(
                 UpperCAmelCase  ,   num_channels=config.hidden_sizes[i]  ,   pool_size=config.pool_size  ,   hidden_size=config.hidden_sizes[i]  ,   intermediate_size=int(config.hidden_sizes[i] * config.mlp_ratio		)  ,   drop_path=dpr[cur + j]  ,   )		)
        blocks.append(nn.ModuleList(UpperCAmelCase		)		)

       lowercase       : Union[str, Any]						=nn.ModuleList(UpperCAmelCase		)






      def 					A__   (			self      :		List[Any]  ,   UpperCAmelCase      :		Union[str, Any]  ,   UpperCAmelCase      :		Dict=False  ,   UpperCAmelCase      :		Optional[int]=True		)	->	List[Any]:


       '''simple docstring'''

       lowercase       : List[str]						=() if output_hidden_states else None

       lowercase       : int						=pixel_values
       for idx, layers in enumerate(zip(self.patch_embeddings  ,   self.block		)		):
        lowercase	,		lowercase       : List[Any]						=layers
        # Get patch embeddings from hidden_states
        lowercase       : List[Any]						=embedding_layer(UpperCAmelCase		)
        # Send the embeddings through the blocks
        for _, blk in enumerate(UpperCAmelCase		):
         lowercase       : str						=blk(UpperCAmelCase		)
         lowercase       : Dict						=layer_outputs[0]

        if output_hidden_states:
         lowercase       : int						=all_hidden_states + (hidden_states,)

       if not return_dict:
        return tuple(v for v in [hidden_states, all_hidden_states] if v is not None		)

       return BaseModelOutputWithNoAttention(last_hidden_state=UpperCAmelCase  ,   hidden_states=UpperCAmelCase		)





class UpperCAmelCase_       (     __A					):




      """simple docstring"""




      UpperCamelCase_             =      PoolFormerConfig
      UpperCamelCase_             =      '''poolformer'''
      UpperCamelCase_             =      '''pixel_values'''
      UpperCamelCase_             =      True






      def 					A__   (			self      :		str  ,   UpperCAmelCase      :		Any		)	->	Any:


       '''simple docstring'''

       if isinstance(UpperCAmelCase  ,   (nn.Linear, nn.Convad)		):
        module.weight.data.normal_(mean=0.0  ,   std=self.config.initializer_range		)
        if module.bias is not None:
         module.bias.data.zero_()
       elif isinstance(UpperCAmelCase  ,   nn.LayerNorm		):
        module.bias.data.zero_()
        module.weight.data.fill_(1.0		)






      def 					A__   (			self      :		Dict  ,   UpperCAmelCase      :		Tuple  ,   UpperCAmelCase      :		Optional[int]=False		)	->	int:


       '''simple docstring'''

       if isinstance(UpperCAmelCase  ,   UpperCAmelCase		):
        lowercase       : Optional[int]						=value





SCREAMING_SNAKE_CASE							=						r'\n    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) sub-class. Use\n    it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and\n    behavior.\n\n    Parameters:\n        config ([`PoolFormerConfig`]): Model configuration class with all the parameters of the model.\n            Initializing with a config file does not load the weights associated with the model, only the\n            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.\n'

SCREAMING_SNAKE_CASE							=						r'\n    Args:\n        pixel_values (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`):\n            Pixel values. Pixel values can be obtained using [`AutoImageProcessor`]. See\n            [`PoolFormerImageProcessor.__call__`] for details.\n'
@add_start_docstrings(
    '''The bare PoolFormer Model transformer outputting raw hidden-states without any specific head on top.'''					,							__A					,							)
class UpperCAmelCase_       (     __A					):




      """simple docstring"""




      def __init__(			self      :		str  ,   UpperCAmelCase      :		Union[str, Any]		)	->	Any:


       '''simple docstring'''

       super().__init__(UpperCAmelCase		)
       lowercase       : str						=config

       lowercase       : str						=PoolFormerEncoder(UpperCAmelCase		)

       # Initialize weights and apply final processing
       self.post_init()






      def 					A__   (			self      :		str		)	->	Tuple:


       '''simple docstring'''

       return self.embeddings.patch_embeddings






      @add_start_docstrings_to_model_forward(UpperCAmelCase		)
      @add_code_sample_docstrings(
          checkpoint=_CHECKPOINT_FOR_DOC  ,   output_type=UpperCAmelCase  ,   config_class=_CONFIG_FOR_DOC  ,   modality='''vision'''  ,   expected_output=_EXPECTED_OUTPUT_SHAPE  ,   )
      def 					A__   (			self      :		Any  ,   UpperCAmelCase      :		Optional[torch.FloatTensor] = None  ,   UpperCAmelCase      :		Optional[bool] = None  ,   UpperCAmelCase      :		Optional[bool] = None  ,   )	->	Union[Tuple, BaseModelOutputWithNoAttention]:


       '''simple docstring'''

       lowercase       : List[Any]						=(
           output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
       )
       lowercase       : int						=return_dict if return_dict is not None else self.config.use_return_dict

       if pixel_values is None:
        raise ValueError('''You have to specify pixel_values'''		)

       lowercase       : Optional[int]						=self.encoder(
           UpperCAmelCase  ,   output_hidden_states=UpperCAmelCase  ,   return_dict=UpperCAmelCase  ,   )
       lowercase       : Dict						=encoder_outputs[0]

       if not return_dict:
        return (sequence_output, None) + encoder_outputs[1:]

       return BaseModelOutputWithNoAttention(
           last_hidden_state=UpperCAmelCase  ,   hidden_states=encoder_outputs.hidden_states  ,   )





class UpperCAmelCase_       (     nn.Module					):




      """simple docstring"""




      def __init__(			self      :		Tuple  ,   UpperCAmelCase      :		Dict		)	->	int:


       '''simple docstring'''

       super().__init__()
       lowercase       : int						=nn.Linear(config.hidden_size  ,   config.hidden_size		)






      def 					A__   (			self      :		str  ,   UpperCAmelCase      :		List[str]		)	->	Tuple:


       '''simple docstring'''

       lowercase       : Tuple						=self.dense(UpperCAmelCase		)
       return output





@add_start_docstrings(
    '''
    PoolFormer Model transformer with an image classification head on top
    '''					,							__A					,							)
class UpperCAmelCase_       (     __A					):




      """simple docstring"""




      def __init__(			self      :		int  ,   UpperCAmelCase      :		Optional[int]		)	->	List[Any]:


       '''simple docstring'''

       super().__init__(UpperCAmelCase		)
       lowercase       : List[Any]						=config.num_labels
       lowercase       : str						=PoolFormerModel(UpperCAmelCase		)

       # Final norm
       lowercase       : Dict						=PoolFormerGroupNorm(config.hidden_sizes[-1]		)
       # Classifier head
       lowercase       : List[str]						=(
           nn.Linear(config.hidden_sizes[-1]  ,   config.num_labels		) if config.num_labels > 0 else nn.Identity()
       )

       # Initialize weights and apply final processing
       self.post_init()






      @add_start_docstrings_to_model_forward(UpperCAmelCase		)
      @add_code_sample_docstrings(
          checkpoint=_IMAGE_CLASS_CHECKPOINT  ,   output_type=UpperCAmelCase  ,   config_class=_CONFIG_FOR_DOC  ,   expected_output=_IMAGE_CLASS_EXPECTED_OUTPUT  ,   )
      def 					A__   (			self      :		Tuple  ,   UpperCAmelCase      :		Optional[torch.FloatTensor] = None  ,   UpperCAmelCase      :		Optional[torch.LongTensor] = None  ,   UpperCAmelCase      :		Optional[bool] = None  ,   UpperCAmelCase      :		Optional[bool] = None  ,   )	->	Union[Tuple, ImageClassifierOutputWithNoAttention]:


       '''simple docstring'''

       lowercase       : int						=return_dict if return_dict is not None else self.config.use_return_dict

       lowercase       : Tuple						=self.poolformer(
           UpperCAmelCase  ,   output_hidden_states=UpperCAmelCase  ,   return_dict=UpperCAmelCase  ,   )

       lowercase       : Optional[Any]						=outputs[0]

       lowercase       : Tuple						=self.classifier(self.norm(UpperCAmelCase		).mean([-2, -1]		)		)

       lowercase       : List[Any]						=None
       if labels is not None:
        if self.config.problem_type is None:
         if self.num_labels == 1:
          lowercase       : int						='''regression'''
         elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
          lowercase       : int						='''single_label_classification'''
         else:
          lowercase       : Optional[Any]						='''multi_label_classification'''

        if self.config.problem_type == "regression":
         lowercase       : Optional[Any]						=MSELoss()
         if self.num_labels == 1:
          lowercase       : Dict						=loss_fct(logits.squeeze()  ,   labels.squeeze()		)
         else:
          lowercase       : List[Any]						=loss_fct(UpperCAmelCase  ,   UpperCAmelCase		)
        elif self.config.problem_type == "single_label_classification":
         lowercase       : List[Any]						=CrossEntropyLoss()
         lowercase       : List[str]						=loss_fct(logits.view(-1  ,   self.num_labels		)  ,   labels.view(-1		)		)
        elif self.config.problem_type == "multi_label_classification":
         lowercase       : Union[str, Any]						=BCEWithLogitsLoss()
         lowercase       : Union[str, Any]						=loss_fct(UpperCAmelCase  ,   UpperCAmelCase		)

       if not return_dict:
        lowercase       : str						=(logits,) + outputs[2:]
        return ((loss,) + output) if loss is not None else output

       return ImageClassifierOutputWithNoAttention(loss=UpperCAmelCase  ,   logits=UpperCAmelCase  ,   hidden_states=outputs.hidden_states		)







import copy
import os
from typing import Union

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


lowerCAmelCase__			:      Tuple								=logging.get_logger(__name__)

lowerCAmelCase__			:      Optional[int]								={
    'microsoft/git-base': 'https://huggingface.co/microsoft/git-base/resolve/main/config.json',
}







class 	__lowercase    (__SCREAMING_SNAKE_CASE  ):





							"""simple docstring"""







							_UpperCAmelCase      =						"""git_vision_model"""






							def __init__(      self			,						lowerCAmelCase__=7_6_8			,						lowerCAmelCase__=3_0_7_2			,						lowerCAmelCase__=1_2			,						lowerCAmelCase__=1_2			,						lowerCAmelCase__=3			,						lowerCAmelCase__=2_2_4			,						lowerCAmelCase__=1_6			,						lowerCAmelCase__="quick_gelu"			,						lowerCAmelCase__=1E-5			,						lowerCAmelCase__=0.0			,						lowerCAmelCase__=0.02			,						**lowerCAmelCase__			,						):





										"""simple docstring"""




										super().__init__(**lowerCAmelCase__       )

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






							@classmethod
							def 					UpperCamelCase__     (      cls			,						lowerCAmelCase__			,						**lowerCAmelCase__       ):





										"""simple docstring"""




										cls._set_token_in_kwargs(lowerCAmelCase__       )

										SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		:     List[str]					=					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_		:     Union[str, Any]					=					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 	__lowercase    (__SCREAMING_SNAKE_CASE  ):





							"""simple docstring"""







							_UpperCAmelCase      =						"""git"""






							def __init__(      self			,						lowerCAmelCase__=None			,						lowerCAmelCase__=3_0_5_2_2			,						lowerCAmelCase__=7_6_8			,						lowerCAmelCase__=6			,						lowerCAmelCase__=1_2			,						lowerCAmelCase__=3_0_7_2			,						lowerCAmelCase__="gelu"			,						lowerCAmelCase__=0.1			,						lowerCAmelCase__=0.1			,						lowerCAmelCase__=1_0_2_4			,						lowerCAmelCase__=0.02			,						lowerCAmelCase__=1E-12			,						lowerCAmelCase__=0			,						lowerCAmelCase__="absolute"			,						lowerCAmelCase__=True			,						lowerCAmelCase__=False			,						lowerCAmelCase__=1_0_1			,						lowerCAmelCase__=1_0_2			,						lowerCAmelCase__=None			,						**lowerCAmelCase__			,						):





										"""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_		:     Dict					=					{}
													logger.info('vision_config is None. initializing the GitVisionConfig with default values.'       )

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

										SCREAMING_SNAKE_CASE_		:     List[str]					=					bos_token_id
										SCREAMING_SNAKE_CASE_		:     str					=					eos_token_id






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					copy.deepcopy(self.__dict__       )
										SCREAMING_SNAKE_CASE_		:     str					=					self.vision_config.to_dict()
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					self.__class__.model_type
										return output





