



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


snake_case_					:      Union[str, Any]    			=    logging.get_logger(__name__)

snake_case_					:      List[str]    			=    {
    '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 				lowercase__      (				lowercase  ):
	lowercase__    							=     """mctct"""





	def __init__(					self   :							Any					,lowerCamelCase__   :							List[str]=8065					,lowerCamelCase__   :							int=1536					,lowerCamelCase__   :							List[str]=36					,lowerCamelCase__   :							Dict=6144					,lowerCamelCase__   :							Dict=4					,lowerCamelCase__   :							Tuple=384					,lowerCamelCase__   :							str=920					,lowerCamelCase__   :							Optional[int]=1E-5					,lowerCamelCase__   :							List[str]=0.3					,lowerCamelCase__   :							Union[str, Any]="relu"					,lowerCamelCase__   :							int=0.0_2					,lowerCamelCase__   :							Dict=0.3					,lowerCamelCase__   :							Optional[int]=0.3					,lowerCamelCase__   :							Union[str, Any]=1					,lowerCamelCase__   :							List[str]=0					,lowerCamelCase__   :							Optional[int]=2					,lowerCamelCase__   :							str=1					,lowerCamelCase__   :							Tuple=0.3					,lowerCamelCase__   :							Optional[int]=1					,lowerCamelCase__   :							int=(7,)					,lowerCamelCase__   :							Any=(3,)					,lowerCamelCase__   :							str=80					,lowerCamelCase__   :							List[Any]=1					,lowerCamelCase__   :							List[str]=None					,lowerCamelCase__   :							Optional[Any]="sum"					,lowerCamelCase__   :							Optional[Any]=False					,**lowerCamelCase__   :							List[str]					,):







							'''simple docstring'''
							super().__init__(**lowerCamelCase__					,pad_token_id=lowerCamelCase__					,bos_token_id=lowerCamelCase__					,eos_token_id=lowerCamelCase__					)
							_UpperCamelCase   :						List[Any]												=  vocab_size
							_UpperCamelCase   :						Optional[Any]												=  hidden_size
							_UpperCamelCase   :						Dict												=  num_hidden_layers
							_UpperCamelCase   :						List[str]												=  intermediate_size
							_UpperCamelCase   :						Tuple												=  num_attention_heads
							_UpperCamelCase   :						int												=  attention_head_dim
							_UpperCamelCase   :						Optional[int]												=  max_position_embeddings
							_UpperCamelCase   :						Tuple												=  layer_norm_eps
							_UpperCamelCase   :						List[Any]												=  layerdrop
							_UpperCamelCase   :						List[str]												=  hidden_act
							_UpperCamelCase   :						str												=  initializer_range
							_UpperCamelCase   :						Union[str, Any]												=  hidden_dropout_prob
							_UpperCamelCase   :						Any												=  attention_probs_dropout_prob
							_UpperCamelCase   :						Union[str, Any]												=  pad_token_id
							_UpperCamelCase   :						Optional[int]												=  bos_token_id
							_UpperCamelCase   :						List[str]												=  eos_token_id
							_UpperCamelCase   :						Optional[Any]												=  conv_glu_dim
							_UpperCamelCase   :						Tuple												=  conv_dropout
							_UpperCamelCase   :						List[str]												=  num_conv_layers
							_UpperCamelCase   :						str												=  input_feat_per_channel
							_UpperCamelCase   :						Dict												=  input_channels
							_UpperCamelCase   :						Optional[Any]												=  conv_channels
							_UpperCamelCase   :						List[Any]												=  ctc_loss_reduction
							_UpperCamelCase   :						Optional[int]												=  ctc_zero_infinity

							# prevents config testing fail with exporting to json
							_UpperCamelCase   :						Optional[int]												=  list(lowerCamelCase__					)
							_UpperCamelCase   :						List[str]												=  list(lowerCamelCase__					)

							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}`.'					)







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

import numpy as np






def A__       (	UpperCAmelCase_				):
						_UpperCamelCase   :						Any												=  {key: len(UpperCAmelCase_				) for key, value in gen_kwargs.items() if isinstance(UpperCAmelCase_    ,    UpperCAmelCase_				)}
						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   :						Tuple												=  max(lists_lengths.values()    ,    default=0				)
						return max(1    ,    UpperCAmelCase_				)






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






def A__       (	UpperCAmelCase_    ,    UpperCAmelCase_				):
						_UpperCamelCase   :						Tuple												=  _number_of_shards_in_gen_kwargs(UpperCAmelCase_				)
						if num_shards == 1:
												return [dict(UpperCAmelCase_				)]
						else:
												_UpperCamelCase   :						str												=  _distribute_shards(num_shards=UpperCAmelCase_    ,    max_num_jobs=UpperCAmelCase_				)
												return [
												    {
												        key: [value[shard_idx] for shard_idx in shard_indices_per_group[group_idx]]
												        if isinstance(UpperCAmelCase_    ,    UpperCAmelCase_				)
												        else value
												        for key, value in gen_kwargs.items()
												    }
												    for group_idx in range(len(UpperCAmelCase_				)				)
												]






def A__       (	UpperCAmelCase_				):
						return {
						    key: [value for gen_kwargs in gen_kwargs_list for value in gen_kwargs[key]]
						    if isinstance(gen_kwargs_list[0][key]    ,    UpperCAmelCase_				)
						    else gen_kwargs_list[0][key]
						    for key in gen_kwargs_list[0]
						}






def A__       (	UpperCAmelCase_    ,    UpperCAmelCase_				):
						_UpperCamelCase   :						int												=  {len(UpperCAmelCase_				) for value in gen_kwargs.values() if isinstance(UpperCAmelCase_    ,    UpperCAmelCase_				)}
						_UpperCamelCase   :						Union[str, Any]												=  {}
						for size in list_sizes:
												_UpperCamelCase   :						str												=  list(range(UpperCAmelCase_				)				)
												rng.shuffle(indices_per_size[size]				)
						# Now let's copy the gen_kwargs and shuffle the lists based on their sizes
						_UpperCamelCase   :						Union[str, Any]												=  dict(UpperCAmelCase_				)
						for key, value in shuffled_kwargs.items():
												if isinstance(UpperCAmelCase_    ,    UpperCAmelCase_				):
																		_UpperCamelCase   :						Dict												=  [value[i] for i in indices_per_size[len(UpperCAmelCase_				)]]
						return shuffled_kwargs


