
'''simple docstring'''







import warnings

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


_lowercase			:  Optional[int]   							=	logging.get_logger(__name__)

_lowercase			:  int   							=	{
    "xlnet-base-cased": "https://huggingface.co/xlnet-base-cased/resolve/main/config.json",
    "xlnet-large-cased": "https://huggingface.co/xlnet-large-cased/resolve/main/config.json",
}






class 			lowerCAmelCase__       (  lowerCamelCase_					):
					lowerCAmelCase_					       =					'''xlnet'''
					lowerCAmelCase_					       =					['''mems''']
					lowerCAmelCase_					       =					{
					    '''n_token''': '''vocab_size''',  # Backward compatibility
					    '''hidden_size''': '''d_model''',
					    '''num_attention_heads''': '''n_head''',
					    '''num_hidden_layers''': '''n_layer''',
					}






					def __init__(       self    ,							__SCREAMING_SNAKE_CASE=3_20_00    ,							__SCREAMING_SNAKE_CASE=10_24    ,							__SCREAMING_SNAKE_CASE=24    ,							__SCREAMING_SNAKE_CASE=16    ,							__SCREAMING_SNAKE_CASE=40_96    ,							__SCREAMING_SNAKE_CASE="gelu"    ,							__SCREAMING_SNAKE_CASE=True    ,							__SCREAMING_SNAKE_CASE="bi"    ,							__SCREAMING_SNAKE_CASE=0.02    ,							__SCREAMING_SNAKE_CASE=1E-1_2    ,							__SCREAMING_SNAKE_CASE=0.1    ,							__SCREAMING_SNAKE_CASE=5_12    ,							__SCREAMING_SNAKE_CASE=None    ,							__SCREAMING_SNAKE_CASE=True    ,							__SCREAMING_SNAKE_CASE=False    ,							__SCREAMING_SNAKE_CASE=False    ,							__SCREAMING_SNAKE_CASE=-1    ,							__SCREAMING_SNAKE_CASE=False    ,							__SCREAMING_SNAKE_CASE="last"    ,							__SCREAMING_SNAKE_CASE=True    ,							__SCREAMING_SNAKE_CASE="tanh"    ,							__SCREAMING_SNAKE_CASE=0.1    ,							__SCREAMING_SNAKE_CASE=5    ,							__SCREAMING_SNAKE_CASE=5    ,							__SCREAMING_SNAKE_CASE=5    ,							__SCREAMING_SNAKE_CASE=1    ,							__SCREAMING_SNAKE_CASE=2    ,							**__SCREAMING_SNAKE_CASE    ,							):


											"""simple docstring"""





											lowercase_     :					Dict													=	vocab_size
											lowercase_     :					str													=	d_model
											lowercase_     :					List[str]													=	n_layer
											lowercase_     :					Dict													=	n_head
											if d_model % n_head != 0:
																	raise ValueError(F'''\'d_model % n_head\' ({d_model % n_head}) should be equal to 0'''		)
											if "d_head" in kwargs:
																	if kwargs["d_head"] != d_model // n_head:
																							raise ValueError(
																							    F'''`d_head` ({kwargs['d_head']}) should be equal to `d_model // n_head` ({d_model // n_head})'''		)
											lowercase_     :					Dict													=	d_model // n_head
											lowercase_     :					int													=	ff_activation
											lowercase_     :					Tuple													=	d_inner
											lowercase_     :					List[Any]													=	untie_r
											lowercase_     :					List[str]													=	attn_type

											lowercase_     :					str													=	initializer_range
											lowercase_     :					Tuple													=	layer_norm_eps

											lowercase_     :					Union[str, Any]													=	dropout
											lowercase_     :					Optional[int]													=	mem_len
											lowercase_     :					int													=	reuse_len
											lowercase_     :					Union[str, Any]													=	bi_data
											lowercase_     :					Union[str, Any]													=	clamp_len
											lowercase_     :					Tuple													=	same_length

											lowercase_     :					Any													=	summary_type
											lowercase_     :					Dict													=	summary_use_proj
											lowercase_     :					int													=	summary_activation
											lowercase_     :					Any													=	summary_last_dropout
											lowercase_     :					Optional[int]													=	start_n_top
											lowercase_     :					Dict													=	end_n_top

											lowercase_     :					Optional[int]													=	bos_token_id
											lowercase_     :					Optional[int]													=	pad_token_id
											lowercase_     :					Optional[Any]													=	eos_token_id

											if "use_cache" in kwargs:
																	warnings.warn(
																	    '''The `use_cache` argument is deprecated and will be removed in a future version, use `use_mems_eval`'''
																	    ''' instead.'''    ,							__SCREAMING_SNAKE_CASE    ,							)
																	lowercase_     :					Optional[Any]													=	kwargs['''use_cache''']

											lowercase_     :					Optional[int]													=	use_mems_eval
											lowercase_     :					List[Any]													=	use_mems_train
											super().__init__(pad_token_id=__SCREAMING_SNAKE_CASE    ,							bos_token_id=__SCREAMING_SNAKE_CASE    ,							eos_token_id=__SCREAMING_SNAKE_CASE    ,							**__SCREAMING_SNAKE_CASE		)






					@property
					def      _snake_case   (       self		):


											"""simple docstring"""





											logger.info(F'''The model {self.model_type} is one of the few models that has no sequence length limit.'''		)
											return -1






					@max_position_embeddings.setter
					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											raise NotImplementedError(
											    F'''The model {self.model_type} is one of the few models that has no sequence length limit.'''		)





'''simple docstring'''







from __future__ import annotations

from typing import Any






class 			lowerCAmelCase__       :






					def __init__(       self    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											lowercase_     :					str													=	num_of_nodes
											lowercase_     :					list[list[int]]													=	[]
											lowercase_     :					dict[int, int]													=	{}






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





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






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE		):


											"""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    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											if self.m_component[u_node] != u_node:
																	for k in self.m_component:
																							lowercase_     :					Optional[int]													=	self.find_component(__SCREAMING_SNAKE_CASE		)






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											if component_size[u_node] <= component_size[v_node]:
																	lowercase_     :					Any													=	v_node
																	component_size[v_node] += component_size[u_node]
																	self.set_component(__SCREAMING_SNAKE_CASE		)

											elif component_size[u_node] >= component_size[v_node]:
																	lowercase_     :					int													=	self.find_component(__SCREAMING_SNAKE_CASE		)
																	component_size[u_node] += component_size[v_node]
																	self.set_component(__SCREAMING_SNAKE_CASE		)






					def      _snake_case   (       self		):


											"""simple docstring"""





											lowercase_     :					Dict													=	[]
											lowercase_     :					Optional[Any]													=	0

											lowercase_     :					list[Any]													=	[-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_     :					Union[str, Any]													=	self.m_num_of_nodes

											while num_of_components > 1:
																	for edge in self.m_edges:
																							lowercase_						,			lowercase_						,			lowercase_     :					List[Any]													=	edge

																							lowercase_     :					Dict													=	self.m_component[u]
																							lowercase_     :					Any													=	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_     :					Union[str, Any]													=	[u, v, w]

																	for edge in minimum_weight_edge:
																							if isinstance(__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE		):
																													lowercase_						,			lowercase_						,			lowercase_     :					str													=	edge

																													lowercase_     :					Tuple													=	self.m_component[u]
																													lowercase_     :					Union[str, Any]													=	self.m_component[v]

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

																	lowercase_     :					str													=	[-1] * self.m_num_of_nodes
											print(F'''The total weight of the minimal spanning tree is: {mst_weight}'''		)







def  snake_case_		(    ):



						"""simple docstring"""







if __name__ == "__main__":
							import doctest

							doctest.testmod()



