"""simple docstring"""




from collections import deque






def      UpperCAmelCase    (		UpperCamelCase__ ):






							"""simple docstring"""





							A__		   =							len(UpperCamelCase__ )
							A__		   =							deque()
							A__		   =							[False for _ in range(UpperCamelCase__ )]
							A__		   =							[-1 for _ in range(UpperCamelCase__ )]
							A__		   =							index_of[:]

							def strong_connect(UpperCamelCase__				,			UpperCamelCase__				,			UpperCamelCase__ ):
														A__		   =							index  # the number when this node is seen
														A__		   =							index  # lowest rank node reachable from here
														index += 1
														stack.append(UpperCamelCase__ )
														A__		   =							True

														for w in g[v]:
																					if index_of[w] == -1:
																												A__		   =							strong_connect(UpperCamelCase__				,			UpperCamelCase__				,			UpperCamelCase__ )
																												A__		   =							(
																												    lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
																												)
																					elif on_stack[w]:
																												A__		   =							(
																												    lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
																												)

														if lowlink_of[v] == index_of[v]:
																					A__		   =							[]
																					A__		   =							stack.pop()
																					A__		   =							False
																					component.append(UpperCamelCase__ )
																					while w != v:
																												A__		   =							stack.pop()
																												A__		   =							False
																												component.append(UpperCamelCase__ )
																					components.append(UpperCamelCase__ )
														return index

							A__		   =							[]
							for v in range(UpperCamelCase__ ):
														if index_of[v] == -1:
																					strong_connect(UpperCamelCase__				,			0				,			UpperCamelCase__ )

							return components






def      UpperCAmelCase    (		UpperCamelCase__				,			UpperCamelCase__ ):






							"""simple docstring"""





							A__		   =							[[] for _ in range(UpperCamelCase__ )]
							for u, v in edges:
														g[u].append(UpperCamelCase__ )
							return g


if __name__ == "__main__":
				# Test
				__lowerCamelCase							 =     7
				__lowerCamelCase							 =     [0, 0, 1, 2, 3, 3, 4, 4, 6]
				__lowerCamelCase							 =     [1, 3, 2, 0, 1, 4, 5, 6, 5]
				__lowerCamelCase							 =     [(u, v) for u, v in zip(source, target)]
				__lowerCamelCase							 =     create_graph(n_vertices, edges)

				assert [[5], [6], [4], [3, 2, 1, 0]] == tarjan(g)






"""simple docstring"""




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


__lowerCamelCase							 =     logging.get_logger(__name__)

__lowerCamelCase							 =     {
    "transfo-xl-wt103": "https://huggingface.co/transfo-xl-wt103/resolve/main/config.json",
}
class 			UpperCamelCase__(	__A       ):
						lowerCAmelCase__     :  Union[str, Any]  							=						'transfo-xl'
						lowerCAmelCase__     :  Any  							=						['mems']
						lowerCAmelCase__     :  Tuple  							=						{
						    'n_token': 'vocab_size',
						    'hidden_size': 'd_model',
						    'num_attention_heads': 'n_head',
						    'num_hidden_layers': 'n_layer',
						}





						def __init__(				self						,__UpperCAmelCase=26_77_35						,__UpperCAmelCase=[2_00_00, 4_00_00, 20_00_00]						,__UpperCAmelCase=10_24						,__UpperCAmelCase=10_24						,__UpperCAmelCase=16						,__UpperCAmelCase=64						,__UpperCAmelCase=40_96						,__UpperCAmelCase=4						,__UpperCAmelCase=False						,__UpperCAmelCase=18						,__UpperCAmelCase=16_00						,__UpperCAmelCase=10_00						,__UpperCAmelCase=True						,__UpperCAmelCase=True						,__UpperCAmelCase=0						,__UpperCAmelCase=-1						,__UpperCAmelCase=True						,__UpperCAmelCase=0.1						,__UpperCAmelCase=0.0						,__UpperCAmelCase=True						,__UpperCAmelCase="normal"						,__UpperCAmelCase=0.0_1						,__UpperCAmelCase=0.0_1						,__UpperCAmelCase=0.0_2						,__UpperCAmelCase=1e-5						,__UpperCAmelCase=0						,**__UpperCAmelCase						,)    -> Tuple:
													A__		   =							vocab_size
													A__		   =							[]
													self.cutoffs.extend(__UpperCAmelCase   )
													if proj_share_all_but_first:
																				A__		   =							[False] + [True] * len(self.cutoffs   )
													else:
																				A__		   =							[False] + [False] * len(self.cutoffs   )
													A__		   =							d_model
													A__		   =							d_embed
													A__		   =							d_head
													A__		   =							d_inner
													A__		   =							div_val
													A__		   =							pre_lnorm
													A__		   =							n_layer
													A__		   =							n_head
													A__		   =							mem_len
													A__		   =							same_length
													A__		   =							attn_type
													A__		   =							clamp_len
													A__		   =							sample_softmax
													A__		   =							adaptive
													A__		   =							dropout
													A__		   =							dropatt
													A__		   =							untie_r
													A__		   =							init
													A__		   =							init_range
													A__		   =							proj_init_std
													A__		   =							init_std
													A__		   =							layer_norm_epsilon
													super().__init__(eos_token_id=__UpperCAmelCase						,**__UpperCAmelCase   )





						@property
						def  snake_case__		(				self   )    -> Optional[Any]:
													# Message copied from Transformer-XL documentation
													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						,__UpperCAmelCase   )    -> int:
													# Message copied from Transformer-XL documentation
													raise NotImplementedError(
													    f'''The model {self.model_type} is one of the few models that has no sequence length limit.'''   )





