
"""simple docstring"""





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


__SCREAMING_SNAKE_CASE					:						Dict				= logging.get_logger(__name__)



class __lowerCAmelCase				(					__UpperCAmelCase     ,				__UpperCAmelCase      ):




			"""simple docstring"""







			snake_case	      =				"""maskformer-swin"""

			snake_case	      =				{
			    """num_attention_heads""": """num_heads""",
			    """num_hidden_layers""": """num_layers""",
			}




			def __init__(				self						:					List[str]       ,   _snake_case						:					Tuple=224       ,   _snake_case						:					Dict=4       ,   _snake_case						:					List[str]=3       ,   _snake_case						:					List[str]=96       ,   _snake_case						:					List[str]=[2, 2, 6, 2]       ,   _snake_case						:					Union[str, Any]=[3, 6, 12, 24]       ,   _snake_case						:					str=7       ,   _snake_case						:					Tuple=4.0       ,   _snake_case						:					str=True       ,   _snake_case						:					Optional[int]=0.0       ,   _snake_case						:					int=0.0       ,   _snake_case						:					Dict=0.1       ,   _snake_case						:					List[str]="gelu"       ,   _snake_case						:					str=False       ,   _snake_case						:					Optional[Any]=0.0_2       ,   _snake_case						:					Tuple=1e-5       ,   _snake_case						:					Union[str, Any]=None       ,   _snake_case						:					Tuple=None       ,   **_snake_case						:					int       ,   )      -> List[str]:







								"""simple docstring"""
								super().__init__(**UpperCAmelCase_	)

								A_				 =						image_size
								A_				 =						patch_size
								A_				 =						num_channels
								A_				 =						embed_dim
								A_				 =						depths
								A_				 =						len(UpperCAmelCase_	)
								A_				 =						num_heads
								A_				 =						window_size
								A_				 =						mlp_ratio
								A_				 =						qkv_bias
								A_				 =						hidden_dropout_prob
								A_				 =						attention_probs_dropout_prob
								A_				 =						drop_path_rate
								A_				 =						hidden_act
								A_				 =						use_absolute_embeddings
								A_				 =						layer_norm_eps
								A_				 =						initializer_range
								# we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
								# this indicates the channel dimension after the last stage of the model
								A_				 =						int(embed_dim * 2 ** (len(UpperCAmelCase_	) - 1)	)
								A_				 =						["stem"] + [F'stage{idx}' for idx in range(1       ,   len(UpperCAmelCase_	) + 1	)]
								A_ ,    A_				 =						get_aligned_output_features_output_indices(
								    out_features=UpperCAmelCase_       ,   out_indices=UpperCAmelCase_       ,   stage_names=self.stage_names	)






"""simple docstring"""





import inspect
import re

from transformers.utils import direct_transformers_import


# 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
UpperCamelCase_					:						Optional[Any]				= '''src/transformers'''


# This is to make sure the transformers module imported is the one in the repo.
UpperCamelCase_					:						Union[str, Any]				= direct_transformers_import(PATH_TO_TRANSFORMERS)

UpperCamelCase_					:						List[Any]				= 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)`
UpperCamelCase_					:						str				= re.compile(R'''\[(.+?)\]\((https://huggingface\.co/.+?)\)''')


UpperCamelCase_					:						Dict				= {
    '''DecisionTransformerConfig''',
    '''EncoderDecoderConfig''',
    '''MusicgenConfig''',
    '''RagConfig''',
    '''SpeechEncoderDecoderConfig''',
    '''TimmBackboneConfig''',
    '''VisionEncoderDecoderConfig''',
    '''VisionTextDualEncoderConfig''',
    '''LlamaConfig''',
}
def 							A_     (__a				):

					'''simple docstring'''





					A_				 =						None

					# source code of `config_class`
					A_				 =						inspect.getsource(__a				)
					A_				 =						_re_checkpoint.findall(__a				)

					# Each `checkpoint` is a tuple of a checkpoint name and a checkpoint link.
					# For example, `('bert-base-uncased', 'https://huggingface.co/bert-base-uncased')`
					for ckpt_name, ckpt_link in checkpoints:
										# allow the link to end with `/`
										if ckpt_link.endswith("/"				):
															A_				 =						ckpt_link[:-1]

										# verify the checkpoint name corresponds to the checkpoint link
										A_				 =						f'https://huggingface.co/{ckpt_name}'
										if ckpt_link == ckpt_link_from_name:
															A_				 =						ckpt_name
															break

					return checkpoint
def 							A_     ():

					'''simple docstring'''





					A_				 =						[]

					for config_class in list(CONFIG_MAPPING.values()				):
										# Skip deprecated models
										if "models.deprecated" in config_class.__module__:
															continue
										A_				 =						get_checkpoint_from_config_class(__a				)

										A_				 =						config_class.__name__
										if checkpoint is None and name not in CONFIG_CLASSES_TO_IGNORE_FOR_DOCSTRING_CHECKPOINT_CHECK:
															configs_without_checkpoint.append(__a				)

					if len(__a				) > 0:
										A_				 =						"\n".join(sorted(__a				)				)
										raise ValueError(f'The following configurations don\'t contain any valid checkpoint:\n{message}'				)


if __name__ == "__main__":
		check_config_docstrings_have_checkpoints()




