
'''simple docstring'''
from typing import List

import numpy as np







def 		A_(     A						:		dict):
							UpperCamelCase   			=     {key: len(A) for key, value in gen_kwargs.items() if isinstance(A		,     A)}
							if len(set(lists_lengths.values())) > 1:
														raise RuntimeError(
														    (
														        'Sharding is ambiguous for this dataset: '
														        + 'we found several data sources lists of different lengths, and we don\'t know over which list we should parallelize:\n'
														        + '\n'.join(f'''\t- key {key} has length {length}''' for key, length in lists_lengths.items())
														        + '\nTo fix this, check the \'gen_kwargs\' and make sure to use lists only for data sources, '
														        + 'and use tuples otherwise. In the end there should only be one single list, or several lists with the same length.'
														    ))
							UpperCamelCase   			=     max(lists_lengths.values()		,     default=0)
							return max(1		,     A)







def 		A_(     A						:		int		,     A						:		int):
							UpperCamelCase   			=     []
							for group_idx in range(A):
														UpperCamelCase   			=     num_shards // max_num_jobs + (group_idx < (num_shards % max_num_jobs))
														if num_shards_to_add == 0:
																					break
														UpperCamelCase   			=     shards_indices_per_group[-1].stop if shards_indices_per_group else 0
														UpperCamelCase   			=     range(A		,     start + num_shards_to_add)
														shards_indices_per_group.append(A)
							return shards_indices_per_group







def 		A_(     A						:		dict		,     A						:		int):
							UpperCamelCase   			=     _number_of_shards_in_gen_kwargs(A)
							if num_shards == 1:
														return [dict(A)]
							else:
														UpperCamelCase   			=     _distribute_shards(num_shards=A		,     max_num_jobs=A)
														return [
														    {
														        key: [value[shard_idx] for shard_idx in shard_indices_per_group[group_idx]]
														        if isinstance(A		,     A)
														        else value
														        for key, value in gen_kwargs.items()
														    }
														    for group_idx in range(len(A))
														]







def 		A_(     A						:		List[dict]):
							return {
							    key: [value for gen_kwargs in gen_kwargs_list for value in gen_kwargs[key]]
							    if isinstance(gen_kwargs_list[0][key]		,     A)
							    else gen_kwargs_list[0][key]
							    for key in gen_kwargs_list[0]
							}







def 		A_(     A						:		np.random.Generator		,     A						:		dict):
							UpperCamelCase   			=     {len(A) for value in gen_kwargs.values() if isinstance(A		,     A)}
							UpperCamelCase   			=     {}
							for size in list_sizes:
														UpperCamelCase   			=     list(range(A))
														rng.shuffle(indices_per_size[size])
							# Now let's copy the gen_kwargs and shuffle the lists based on their sizes
							UpperCamelCase   			=     dict(A)
							for key, value in shuffled_kwargs.items():
														if isinstance(A		,     A):
																					UpperCamelCase   			=     [value[i] for i in indices_per_size[len(A)]]
							return shuffled_kwargs






'''simple docstring'''
from ....configuration_utils import PretrainedConfig
from ....utils import logging


lowerCAmelCase					:    Optional[Any]           = logging.get_logger(__name__)

lowerCAmelCase					:    Dict           = {
    'speechbrain/m-ctc-t-large': 'https://huggingface.co/speechbrain/m-ctc-t-large/resolve/main/config.json',
    # See all M-CTC-T models at https://huggingface.co/models?filter=mctct
}


class 			SCREAMING_SNAKE_CASE__      (     snake_case_):
				lowerCAmelCase_     			=							"""mctct"""







				def __init__(       self						,				A_=8065						,				A_=1536						,				A_=36						,				A_=6144						,				A_=4						,				A_=384						,				A_=920						,				A_=1e-5						,				A_=0.3						,				A_="relu"						,				A_=0.02						,				A_=0.3						,				A_=0.3						,				A_=1						,				A_=0						,				A_=2						,				A_=1						,				A_=0.3						,				A_=1						,				A_=(7,)						,				A_=(3,)						,				A_=80						,				A_=1						,				A_=None						,				A_="sum"						,				A_=False						,				**A_						,				)->		str:







											'''simple docstring'''






											super().__init__(**A_						,				pad_token_id=A_						,				bos_token_id=A_						,				eos_token_id=A_     )
											UpperCamelCase   			=     vocab_size
											UpperCamelCase   			=     hidden_size
											UpperCamelCase   			=     num_hidden_layers
											UpperCamelCase   			=     intermediate_size
											UpperCamelCase   			=     num_attention_heads
											UpperCamelCase   			=     attention_head_dim
											UpperCamelCase   			=     max_position_embeddings
											UpperCamelCase   			=     layer_norm_eps
											UpperCamelCase   			=     layerdrop
											UpperCamelCase   			=     hidden_act
											UpperCamelCase   			=     initializer_range
											UpperCamelCase   			=     hidden_dropout_prob
											UpperCamelCase   			=     attention_probs_dropout_prob
											UpperCamelCase   			=     pad_token_id
											UpperCamelCase   			=     bos_token_id
											UpperCamelCase   			=     eos_token_id
											UpperCamelCase   			=     conv_glu_dim
											UpperCamelCase   			=     conv_dropout
											UpperCamelCase   			=     num_conv_layers
											UpperCamelCase   			=     input_feat_per_channel
											UpperCamelCase   			=     input_channels
											UpperCamelCase   			=     conv_channels
											UpperCamelCase   			=     ctc_loss_reduction
											UpperCamelCase   			=     ctc_zero_infinity

											# prevents config testing fail with exporting to json
											UpperCamelCase   			=     list(A_     )
											UpperCamelCase   			=     list(A_     )

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




