

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


a		=logging.get_logger(__name__)

a		={
    """microsoft/trocr-base-handwritten""": (
        """https://huggingface.co/microsoft/trocr-base-handwritten/resolve/main/config.json"""
    ),
    # See all TrOCR models at https://huggingface.co/models?filter=trocr
}






class        A_		(       SCREAMING_SNAKE_CASE				):
							_UpperCAmelCase    :  Tuple						      =      '''trocr'''
							_UpperCAmelCase    :  int						      =      ['''past_key_values''']
							_UpperCAmelCase    :  Any						      =      {
							    '''num_attention_heads''': '''decoder_attention_heads''',
							    '''hidden_size''': '''d_model''',
							    '''num_hidden_layers''': '''decoder_layers''',
							}
							def __init__(		self		:			Optional[Any]   ,SCREAMING_SNAKE_CASE__		:			str=5_0_2_6_5   ,SCREAMING_SNAKE_CASE__		:			int=1_0_2_4   ,SCREAMING_SNAKE_CASE__		:			List[str]=1_2   ,SCREAMING_SNAKE_CASE__		:			str=1_6   ,SCREAMING_SNAKE_CASE__		:			Union[str, Any]=4_0_9_6   ,SCREAMING_SNAKE_CASE__		:			str="gelu"   ,SCREAMING_SNAKE_CASE__		:			Optional[int]=5_1_2   ,SCREAMING_SNAKE_CASE__		:			Tuple=0.1   ,SCREAMING_SNAKE_CASE__		:			Tuple=0.0   ,SCREAMING_SNAKE_CASE__		:			str=0.0   ,SCREAMING_SNAKE_CASE__		:			Any=2   ,SCREAMING_SNAKE_CASE__		:			Any=0.02   ,SCREAMING_SNAKE_CASE__		:			Tuple=0.0   ,SCREAMING_SNAKE_CASE__		:			List[str]=True   ,SCREAMING_SNAKE_CASE__		:			Any=False   ,SCREAMING_SNAKE_CASE__		:			List[str]=True   ,SCREAMING_SNAKE_CASE__		:			str=True   ,SCREAMING_SNAKE_CASE__		:			int=1   ,SCREAMING_SNAKE_CASE__		:			str=0   ,SCREAMING_SNAKE_CASE__		:			List[str]=2   ,**SCREAMING_SNAKE_CASE__		:			int   ,):
								__lowerCamelCase				:				Optional[Any]					       = vocab_size
								__lowerCamelCase				:				Dict					       = d_model
								__lowerCamelCase				:				Union[str, Any]					       = decoder_layers
								__lowerCamelCase				:				Optional[int]					       = decoder_attention_heads
								__lowerCamelCase				:				str					       = decoder_ffn_dim
								__lowerCamelCase				:				Optional[Any]					       = activation_function
								__lowerCamelCase				:				List[Any]					       = max_position_embeddings
								__lowerCamelCase				:				Dict					       = dropout
								__lowerCamelCase				:				Any					       = attention_dropout
								__lowerCamelCase				:				List[str]					       = activation_dropout
								__lowerCamelCase				:				Optional[Any]					       = init_std
								__lowerCamelCase				:				Tuple					       = decoder_layerdrop
								__lowerCamelCase				:				Dict					       = use_cache
								__lowerCamelCase				:				Dict					       = scale_embedding
								__lowerCamelCase				:				List[str]					       = use_learned_position_embeddings
								__lowerCamelCase				:				int					       = layernorm_embedding

								super().__init__(
								    pad_token_id=SCREAMING_SNAKE_CASE__   ,bos_token_id=SCREAMING_SNAKE_CASE__   ,eos_token_id=SCREAMING_SNAKE_CASE__   ,decoder_start_token_id=SCREAMING_SNAKE_CASE__   ,**SCREAMING_SNAKE_CASE__   ,)







'''simple docstring'''



from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


UpperCAmelCase :       Optional[int]			   =     logging.get_logger(__name__)

UpperCAmelCase :       str			   =     {
    'facebook/convnextv2-tiny-1k-224': 'https://huggingface.co/facebook/convnextv2-tiny-1k-224/resolve/main/config.json',
}







class 						lowerCAmelCase__   (      a ,					a					):



 """simple docstring"""



 lowerCAmelCase__  					=      "convnextv2"
 def __init__(		self					:       Any					,							__SCREAMING_SNAKE_CASE					:       int=3					,							__SCREAMING_SNAKE_CASE					:       Dict=4					,							__SCREAMING_SNAKE_CASE					:       List[Any]=4					,							__SCREAMING_SNAKE_CASE					:       Optional[int]=None					,							__SCREAMING_SNAKE_CASE					:       Dict=None					,							__SCREAMING_SNAKE_CASE					:       Optional[int]="gelu"					,							__SCREAMING_SNAKE_CASE					:       Union[str, Any]=0.02					,							__SCREAMING_SNAKE_CASE					:       Dict=1E-12					,							__SCREAMING_SNAKE_CASE					:       List[str]=0.0					,							__SCREAMING_SNAKE_CASE					:       Optional[Any]=224					,							__SCREAMING_SNAKE_CASE					:       Tuple=None					,							__SCREAMING_SNAKE_CASE					:       List[str]=None					,							**__SCREAMING_SNAKE_CASE					:       Union[str, Any]					,							)  -> Union[str, Any]:


      """simple docstring"""




      super().__init__(**__SCREAMING_SNAKE_CASE			)

      __SCREAMING_SNAKE_CASE     =      num_channels
      __SCREAMING_SNAKE_CASE     =      patch_size
      __SCREAMING_SNAKE_CASE     =      num_stages
      __SCREAMING_SNAKE_CASE     =      [96, 192, 384, 768] if hidden_sizes is None else hidden_sizes
      __SCREAMING_SNAKE_CASE     =      [3, 3, 9, 3] if depths is None else depths
      __SCREAMING_SNAKE_CASE     =      hidden_act
      __SCREAMING_SNAKE_CASE     =      initializer_range
      __SCREAMING_SNAKE_CASE     =      layer_norm_eps
      __SCREAMING_SNAKE_CASE     =      drop_path_rate
      __SCREAMING_SNAKE_CASE     =      image_size
      __SCREAMING_SNAKE_CASE     =      ["""stem"""] + [f'stage{idx}' for idx in range(1					,							len(self.depths			) + 1			)]
      __SCREAMING_SNAKE_CASE   ,			__SCREAMING_SNAKE_CASE     =      get_aligned_output_features_output_indices(
          out_features=__SCREAMING_SNAKE_CASE					,							out_indices=__SCREAMING_SNAKE_CASE					,							stage_names=self.stage_names			)






