


import importlib
import inspect
import os
import re


# All paths are set with the intent you should run this script from the root of the repo with the command
# python utils/check_config_docstrings.py
lowerCamelCase		   =			'src/transformers'


# This is to make sure the transformers module imported is the one in the repo.
lowerCamelCase		   =			importlib.util.spec_from_file_location(
    'transformers',
    os.path.join(PATH_TO_TRANSFORMERS, '__init__.py'),
    submodule_search_locations=[PATH_TO_TRANSFORMERS],
)
lowerCamelCase		   =			spec.loader.load_module()

lowerCamelCase		   =			transformers.models.auto.configuration_auto.CONFIG_MAPPING

# Regex pattern used to find the checkpoint mentioned in the docstring of `config_class`.
# For example, `[bert-base-uncased](https://huggingface.co/bert-base-uncased)`
lowerCamelCase		   =			re.compile('\[(.+?)\]\((https://huggingface\.co/.+?)\)')


lowerCamelCase		   =			{
    'CLIPConfigMixin',
    'DecisionTransformerConfigMixin',
    'EncoderDecoderConfigMixin',
    'RagConfigMixin',
    'SpeechEncoderDecoderConfigMixin',
    'VisionEncoderDecoderConfigMixin',
    'VisionTextDualEncoderConfigMixin',
}




def       a_ (       ):
       '''simple docstring'''





       _lowerCamelCase			:						List[str]            =[]

       for config_class in list(CONFIG_MAPPING.values()	):
              _lowerCamelCase			:						int            =False

              # source code of `config_class`
              _lowerCamelCase			:						Tuple            =inspect.getsource(SCREAMING_SNAKE_CASE__	)
              _lowerCamelCase			:						int            =_re_checkpoint.findall(SCREAMING_SNAKE_CASE__	)

              for checkpoint in checkpoints:
                     # Each `checkpoint` is a tuple of a checkpoint name and a checkpoint link.
                     # For example, `('bert-base-uncased', 'https://huggingface.co/bert-base-uncased')`
                     _lowerCamelCase      ,	_lowerCamelCase			:						Tuple            =checkpoint

                     # verify the checkpoint name corresponds to the checkpoint link
                     _lowerCamelCase			:						Tuple            =F'''https://huggingface.co/{ckpt_name}'''
                     if ckpt_link == ckpt_link_from_name:
                            _lowerCamelCase			:						Dict            =True
                            break

              _lowerCamelCase			:						Optional[int]            =config_class.__name__
              if not checkpoint_found and name not in CONFIG_CLASSES_TO_IGNORE_FOR_DOCSTRING_CHECKPOINT_CHECK:
                     configs_without_checkpoint.append(SCREAMING_SNAKE_CASE__	)

       if len(SCREAMING_SNAKE_CASE__	) > 0:
              _lowerCamelCase			:						Optional[Any]            ='\n'.join(sorted(SCREAMING_SNAKE_CASE__	)	)
              raise ValueError(F'''The following configurations don\'t contain any valid checkpoint:\n{message}'''	)


if __name__ == "__main__":
 check_config_docstrings_have_checkpoints()






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


lowerCamelCase		   =			logging.get_logger(__name__)

lowerCamelCase		   =			{
    'microsoft/focalnet-tiny': 'https://huggingface.co/microsoft/focalnet-tiny/resolve/main/config.json',
}




class A    (  UpperCamelCase_       ,				UpperCamelCase_	):
      UpperCamelCase__				:    str ='focalnet'






      def __init__(   self		:	Optional[int]     ,  lowercase_		:	List[Any]=224     ,  lowercase_		:	str=4     ,  lowercase_		:	Any=3     ,  lowercase_		:	Dict=96     ,  lowercase_		:	List[str]=False     ,  lowercase_		:	Any=[192, 384, 768, 768]     ,  lowercase_		:	Dict=[2, 2, 6, 2]     ,  lowercase_		:	Optional[int]=[2, 2, 2, 2]     ,  lowercase_		:	List[Any]=[3, 3, 3, 3]     ,  lowercase_		:	Any="gelu"     ,  lowercase_		:	str=4.0     ,  lowercase_		:	List[Any]=0.0     ,  lowercase_		:	Tuple=0.1     ,  lowercase_		:	Optional[Any]=False     ,  lowercase_		:	Optional[int]=1E-4     ,  lowercase_		:	Dict=False     ,  lowercase_		:	Optional[Any]=False     ,  lowercase_		:	Dict=False     ,  lowercase_		:	List[Any]=0.02     ,  lowercase_		:	Any=1E-5     ,  lowercase_		:	Any=32     ,  lowercase_		:	List[str]=None     ,  lowercase_		:	int=None     ,  **lowercase_		:	Optional[Any]     ,  )   ->		Optional[Any]:
             """simple docstring"""




             super().__init__(**lowercase_					)

             _lowerCamelCase			:						Union[str, Any]            =image_size
             _lowerCamelCase			:						str            =patch_size
             _lowerCamelCase			:						str            =num_channels
             _lowerCamelCase			:						Tuple            =embed_dim
             _lowerCamelCase			:						Dict            =use_conv_embed
             _lowerCamelCase			:						int            =hidden_sizes
             _lowerCamelCase			:						str            =depths
             _lowerCamelCase			:						int            =focal_levels
             _lowerCamelCase			:						List[Any]            =focal_windows
             _lowerCamelCase			:						List[Any]            =hidden_act
             _lowerCamelCase			:						int            =mlp_ratio
             _lowerCamelCase			:						Any            =hidden_dropout_prob
             _lowerCamelCase			:						Optional[Any]            =drop_path_rate
             _lowerCamelCase			:						int            =use_layerscale
             _lowerCamelCase			:						str            =layerscale_value
             _lowerCamelCase			:						Dict            =use_post_layernorm
             _lowerCamelCase			:						str            =use_post_layernorm_in_modulation
             _lowerCamelCase			:						List[Any]            =normalize_modulator
             _lowerCamelCase			:						Optional[Any]            =initializer_range
             _lowerCamelCase			:						List[str]            =layer_norm_eps
             _lowerCamelCase			:						Optional[int]            =encoder_stride
             _lowerCamelCase			:						List[str]            =['stem'] + [F'''stage{idx}''' for idx in range(1     ,  len(self.depths					) + 1					)]
             _lowerCamelCase      ,	_lowerCamelCase			:						Union[str, Any]            =get_aligned_output_features_output_indices(
                 out_features=lowercase_     ,  out_indices=lowercase_     ,  stage_names=self.stage_names					)


