






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


__lowerCamelCase   :					List[str]   							=					logging.get_logger(__name__)

__lowerCamelCase   :					Dict   							=					{
    '''facebook/s2t-small-librispeech-asr''': (
        '''https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/main/config.json'''
    ),
    # See all Speech2Text models at https://huggingface.co/models?filter=speech_to_text
}







class    A_	(a_							):
							"""simple docstring"""




							a__   		=	'''speech_to_text'''
							a__   		=	['''past_key_values''']
							a__   		=	{'''num_attention_heads''': '''encoder_attention_heads''', '''hidden_size''': '''d_model'''}

							def __init__(		self			:Optional[Any]       ,							lowerCAmelCase__			:Optional[Any]=10_000       ,							lowerCAmelCase__			:Optional[Any]=12       ,							lowerCAmelCase__			:Tuple=2_048       ,							lowerCAmelCase__			:Optional[int]=4       ,							lowerCAmelCase__			:Optional[int]=6       ,							lowerCAmelCase__			:Union[str, Any]=2_048       ,							lowerCAmelCase__			:Optional[int]=4       ,							lowerCAmelCase__			:int=0.0       ,							lowerCAmelCase__			:str=0.0       ,							lowerCAmelCase__			:Union[str, Any]=True       ,							lowerCAmelCase__			:Dict=True       ,							lowerCAmelCase__			:str="relu"       ,							lowerCAmelCase__			:Dict=256       ,							lowerCAmelCase__			:Optional[int]=0.1       ,							lowerCAmelCase__			:List[str]=0.0       ,							lowerCAmelCase__			:List[Any]=0.0       ,							lowerCAmelCase__			:int=0.0_2       ,							lowerCAmelCase__			:int=2       ,							lowerCAmelCase__			:str=True       ,							lowerCAmelCase__			:Optional[Any]=1       ,							lowerCAmelCase__			:Dict=0       ,							lowerCAmelCase__			:Union[str, Any]=2       ,							lowerCAmelCase__			:Optional[int]=6_000       ,							lowerCAmelCase__			:int=1_024       ,							lowerCAmelCase__			:Union[str, Any]=2       ,							lowerCAmelCase__			:List[Any]=(5, 5)       ,							lowerCAmelCase__			:Optional[Any]=1_024       ,							lowerCAmelCase__			:Union[str, Any]=80       ,							lowerCAmelCase__			:int=1       ,							**lowerCAmelCase__			:Tuple       ,							)				->  Dict:


										'''simple docstring'''




										snake_case_				:					int   =       vocab_size
										snake_case_				:					str   =       d_model
										snake_case_				:					Optional[Any]   =       encoder_ffn_dim
										snake_case_				:					Union[str, Any]   =       encoder_layers
										snake_case_				:					str   =       encoder_attention_heads
										snake_case_				:					Optional[int]   =       decoder_ffn_dim
										snake_case_				:					Optional[int]   =       decoder_layers
										snake_case_				:					Optional[Any]   =       decoder_attention_heads
										snake_case_				:					int   =       dropout
										snake_case_				:					List[Any]   =       attention_dropout
										snake_case_				:					Optional[int]   =       activation_dropout
										snake_case_				:					List[Any]   =       activation_function
										snake_case_				:					Optional[int]   =       init_std
										snake_case_				:					str   =       encoder_layerdrop
										snake_case_				:					Optional[int]   =       decoder_layerdrop
										snake_case_				:					List[Any]   =       use_cache
										snake_case_				:					List[str]   =       encoder_layers
										snake_case_				:					str   =       scale_embedding  # scale factor will be sqrt(d_model) if True
										snake_case_				:					Dict   =       max_source_positions
										snake_case_				:					Optional[int]   =       max_target_positions
										snake_case_				:					Dict   =       num_conv_layers
										snake_case_				:					Tuple   =       list(lowerCAmelCase__				)
										snake_case_				:					str   =       conv_channels
										snake_case_				:					int   =       input_feat_per_channel
										snake_case_				:					List[str]   =       input_channels

										if len(self.conv_kernel_sizes				) != self.num_conv_layers:
													raise ValueError(
													    "Configuration for convolutional module is incorrect. "
													    "It is required that `len(config.conv_kernel_sizes)` == `config.num_conv_layers` "
													    F'''but is `len(config.conv_kernel_sizes) = {len(self.conv_kernel_sizes				)}`, '''
													    F'''`config.num_conv_layers = {self.num_conv_layers}`.'''				)

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












'''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
__lowerCamelCase   :					Any   							=					'''src/transformers'''


# This is to make sure the transformers module imported is the one in the repo.
__lowerCamelCase   :					List[str]   							=					direct_transformers_import(PATH_TO_TRANSFORMERS)

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


__lowerCamelCase   :					Any   							=					{
    '''DecisionTransformerConfig''',
    '''EncoderDecoderConfig''',
    '''MusicgenConfig''',
    '''RagConfig''',
    '''SpeechEncoderDecoderConfig''',
    '''TimmBackboneConfig''',
    '''VisionEncoderDecoderConfig''',
    '''VisionTextDualEncoderConfig''',
    '''LlamaConfig''',
}

def 	__UpperCAmelCase       ( __magic_name__						)->    List[Any]:



			"""simple docstring"""



			snake_case_				:					Tuple   =       None

			# source code of `config_class`
			snake_case_				:					List[Any]   =       inspect.getsource(__magic_name__						)
			snake_case_				:					List[str]   =       _re_checkpoint.findall(__magic_name__						)

			# 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("/"						):
									snake_case_				:					Optional[Any]   =       ckpt_link[:-1]

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

			return checkpoint

def 	__UpperCAmelCase       ( )->    Dict:



			"""simple docstring"""



			snake_case_				:					Optional[int]   =       []

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

						snake_case_				:					Union[str, Any]   =       config_class.__name__
						if checkpoint is None and name not in CONFIG_CLASSES_TO_IGNORE_FOR_DOCSTRING_CHECKPOINT_CHECK:
									configs_without_checkpoint.append(__magic_name__						)

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


if __name__ == "__main__":
		check_config_docstrings_have_checkpoints()




