



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


snake_case__					:     str    		=   logging.get_logger(__name__)

snake_case__					:     Optional[Any]    		=   {
    "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   _A   ( _UpperCAmelCase	):


						'''simple docstring'''





						_snake_case			:     Optional[Any]      							=      """mctct"""



						def __init__(	self	:							str							,      lowerCamelCase	:							Dict=8_065							,      lowerCamelCase	:							Optional[Any]=1_536							,      lowerCamelCase	:							int=36							,      lowerCamelCase	:							List[str]=6_144							,      lowerCamelCase	:							Optional[int]=4							,      lowerCamelCase	:							Tuple=384							,      lowerCamelCase	:							str=920							,      lowerCamelCase	:							List[str]=1e-5							,      lowerCamelCase	:							Optional[int]=0.3							,      lowerCamelCase	:							str="relu"							,      lowerCamelCase	:							Optional[Any]=0.02							,      lowerCamelCase	:							str=0.3							,      lowerCamelCase	:							Union[str, Any]=0.3							,      lowerCamelCase	:							Optional[Any]=1							,      lowerCamelCase	:							Union[str, Any]=0							,      lowerCamelCase	:							str=2							,      lowerCamelCase	:							Union[str, Any]=1							,      lowerCamelCase	:							Union[str, Any]=0.3							,      lowerCamelCase	:							List[Any]=1							,      lowerCamelCase	:							Optional[int]=(7,)							,      lowerCamelCase	:							List[str]=(3,)							,      lowerCamelCase	:							Dict=80							,      lowerCamelCase	:							Union[str, Any]=1							,      lowerCamelCase	:							Any=None							,      lowerCamelCase	:							str="sum"							,      lowerCamelCase	:							List[Any]=False							,      **lowerCamelCase	:							Tuple							,      ):






							'''simple docstring'''



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

							# prevents config testing fail with exporting to json
							__lowercase		       =			list(lowerCamelCase_	)
							__lowercase		       =			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}`."""	)








from __future__ import annotations

from typing import Any

class   _A   :


						'''simple docstring'''





						def __init__(	self	:							Union[str, Any]							,      lowerCamelCase	:							int	):






							'''simple docstring'''



							__lowercase		       =			num_of_nodes
							__lowercase		       =			[]
							__lowercase		       =			{}



						def     _snake_case	(	self	:							Dict							,      lowerCamelCase	:							int							,      lowerCamelCase	:							int							,      lowerCamelCase	:							int	):






							'''simple docstring'''



							self.m_edges.append([u_node, v_node, weight]	)



						def     _snake_case	(	self	:							List[Any]							,      lowerCamelCase	:							int	):






							'''simple docstring'''



							if self.m_component[u_node] == u_node:
								return u_node
							return self.find_component(self.m_component[u_node]	)



						def     _snake_case	(	self	:							Union[str, Any]							,      lowerCamelCase	:							int	):






							'''simple docstring'''



							if self.m_component[u_node] != u_node:
								for k in self.m_component:
									__lowercase		       =			self.find_component(lowerCamelCase	)



						def     _snake_case	(	self	:							Union[str, Any]							,      lowerCamelCase	:							list[int]							,      lowerCamelCase	:							int							,      lowerCamelCase	:							int	):






							'''simple docstring'''



							if component_size[u_node] <= component_size[v_node]:
								__lowercase		       =			v_node
								component_size[v_node] += component_size[u_node]
								self.set_component(lowerCamelCase	)

							elif component_size[u_node] >= component_size[v_node]:
								__lowercase		       =			self.find_component(lowerCamelCase	)
								component_size[u_node] += component_size[v_node]
								self.set_component(lowerCamelCase	)



						def     _snake_case	(	self	:							Any	):






							'''simple docstring'''



							__lowercase		       =			[]
							__lowercase		       =			0

							__lowercase		       =			[-1] * self.m_num_of_nodes

							# A list of components (initialized to all of the nodes)
							for node in range(self.m_num_of_nodes	):
								self.m_component.update({node: node}	)
								component_size.append(1	)

							__lowercase		       =			self.m_num_of_nodes

							while num_of_components > 1:
								for edge in self.m_edges:
									__lowercase       ,    __lowercase       ,    __lowercase		       =			edge

									__lowercase		       =			self.m_component[u]
									__lowercase		       =			self.m_component[v]

									if u_component != v_component:

										for component in (u_component, v_component):
											if (
											    minimum_weight_edge[component] == -1
											    or minimum_weight_edge[component][2] > w
											):
												__lowercase		       =			[u, v, w]

								for edge in minimum_weight_edge:
									if isinstance(lowerCamelCase							,      lowerCamelCase	):
										__lowercase       ,    __lowercase       ,    __lowercase		       =			edge

										__lowercase		       =			self.m_component[u]
										__lowercase		       =			self.m_component[v]

										if u_component != v_component:
											mst_weight += w
											self.union(lowerCamelCase							,      lowerCamelCase							,      lowerCamelCase	)
											print(f"""Added edge [{u} - {v}]\nAdded weight: {w}\n"""	)
											num_of_components -= 1

								__lowercase		       =			[-1] * self.m_num_of_nodes
							print(f"""The total weight of the minimal spanning tree is: {mst_weight}"""	)



def    snake_case_				(    ):
	pass


if __name__ == "__main__":
	import doctest

	doctest.testmod()



