

"""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
__A						   =			"src/transformers"


# This is to make sure the transformers module imported is the one in the repo.
__A						   =			direct_transformers_import(PATH_TO_TRANSFORMERS)

__A						   =			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)`
__A						   =			re.compile(r"\[(.+?)\]\((https://huggingface\.co/.+?)\)")


__A						   =			{
    "DecisionTransformerConfig",
    "EncoderDecoderConfig",
    "MusicgenConfig",
    "RagConfig",
    "SpeechEncoderDecoderConfig",
    "TimmBackboneConfig",
    "VisionEncoderDecoderConfig",
    "VisionTextDualEncoderConfig",
    "LlamaConfig",
}






def     a__    (    __SCREAMING_SNAKE_CASE )	->	List[str]:
		__lowerCAmelCase:       Optional[Any]          =			None

		# source code of `config_class`
		__lowerCAmelCase:       Tuple          =			inspect.getsource(UpperCamelCase__ )
		__lowerCAmelCase:       Tuple          =			_re_checkpoint.findall(UpperCamelCase__ )

		# 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("/" ):
						__lowerCAmelCase:       int          =			ckpt_link[:-1]

				# verify the checkpoint name corresponds to the checkpoint link
				__lowerCAmelCase:       Union[str, Any]          =			F"https://huggingface.co/{ckpt_name}"
				if ckpt_link == ckpt_link_from_name:
						__lowerCAmelCase:       Optional[int]          =			ckpt_name
						break

		return checkpoint






def     a__    (    )	->	List[str]:
		__lowerCAmelCase:       Optional[int]          =			[]

		for config_class in list(CONFIG_MAPPING.values() ):
				# Skip deprecated models
				if "models.deprecated" in config_class.__module__:
						continue
				__lowerCAmelCase:       List[str]          =			get_checkpoint_from_config_class(UpperCamelCase__ )

				__lowerCAmelCase:       Dict          =			config_class.__name__
				if checkpoint is None and name not in CONFIG_CLASSES_TO_IGNORE_FOR_DOCSTRING_CHECKPOINT_CHECK:
						configs_without_checkpoint.append(UpperCamelCase__ )

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


if __name__ == "__main__":
			check_config_docstrings_have_checkpoints()









from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


__A				:    int       =   logging.get_logger(__name__)

__A				:    Tuple       =   {
    "google/bigbird-roberta-base": "https://huggingface.co/google/bigbird-roberta-base/resolve/main/config.json",
    "google/bigbird-roberta-large": "https://huggingface.co/google/bigbird-roberta-large/resolve/main/config.json",
    "google/bigbird-base-trivia-itc": "https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/config.json",
    # See all BigBird models at https://huggingface.co/models?filter=big_bird
}

class 	A_       (a_			):
	UpperCAmelCase__					=			'''big_bird'''
	def __init__(    self							,					_A=5_0_3_5_8							,					_A=7_6_8							,					_A=1_2							,					_A=1_2							,					_A=3_0_7_2							,					_A="gelu_new"							,					_A=0.1							,					_A=0.1							,					_A=4_0_9_6							,					_A=2							,					_A=0.02							,					_A=1E-12							,					_A=True							,					_A=0							,					_A=1							,					_A=2							,					_A=6_6							,					_A="block_sparse"							,					_A=True							,					_A=False							,					_A=6_4							,					_A=3							,					_A=None							,					**_A							,					):






				'''simple docstring'''







				super().__init__(
				    pad_token_id=_A							,					bos_token_id=_A							,					eos_token_id=_A							,					sep_token_id=_A							,					**_A							,					)

				UpperCAmelCase   		=				vocab_size
				UpperCAmelCase   		=				max_position_embeddings
				UpperCAmelCase   		=				hidden_size
				UpperCAmelCase   		=				num_hidden_layers
				UpperCAmelCase   		=				num_attention_heads
				UpperCAmelCase   		=				intermediate_size
				UpperCAmelCase   		=				hidden_act
				UpperCAmelCase   		=				hidden_dropout_prob
				UpperCAmelCase   		=				attention_probs_dropout_prob
				UpperCAmelCase   		=				initializer_range
				UpperCAmelCase   		=				type_vocab_size
				UpperCAmelCase   		=				layer_norm_eps
				UpperCAmelCase   		=				use_cache

				UpperCAmelCase   		=				rescale_embeddings
				UpperCAmelCase   		=				attention_type
				UpperCAmelCase   		=				use_bias
				UpperCAmelCase   		=				block_size
				UpperCAmelCase   		=				num_random_blocks
				UpperCAmelCase   		=				classifier_dropout

class 	A_       (a_			):
	@property
	def      _lowercase				(    self		):






				'''simple docstring'''







				if self.task == "multiple-choice":
							UpperCAmelCase   		=				{0: '''batch''', 1: '''choice''', 2: '''sequence'''}
				else:
							UpperCAmelCase   		=				{0: '''batch''', 1: '''sequence'''}
				return OrderedDict(
				    [
				        ('''input_ids''', dynamic_axis),
				        ('''attention_mask''', dynamic_axis),
				    ]		)



