


from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


A							:					List[str]     						=     logging.get_logger(__name__)

A							:					Union[str, Any]     						=     {
    'google/bigbird-roberta-base': 'https://huggingface.co/google/bigbird-roberta-base/resolve/main/config.json',
    'google/bigbird-roberta-large': 'https://huggingface.co/google/bigbird-roberta-large/resolve/main/config.json',
    'google/bigbird-base-trivia-itc': 'https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/config.json',
    # See all BigBird models at https://huggingface.co/models?filter=big_bird
}






class     UpperCamelCase(  _a   ):
					snake_case_		:				Dict										=	"""big_bird"""


					def __init__(						self	:		Dict     ,    SCREAMING_SNAKE_CASE	:		List[str]=5_0_3_5_8     ,    SCREAMING_SNAKE_CASE	:		List[str]=7_6_8     ,    SCREAMING_SNAKE_CASE	:		str=1_2     ,    SCREAMING_SNAKE_CASE	:		str=1_2     ,    SCREAMING_SNAKE_CASE	:		List[Any]=3_0_7_2     ,    SCREAMING_SNAKE_CASE	:		List[str]="gelu_new"     ,    SCREAMING_SNAKE_CASE	:		Dict=0.1     ,    SCREAMING_SNAKE_CASE	:		Dict=0.1     ,    SCREAMING_SNAKE_CASE	:		str=4_0_9_6     ,    SCREAMING_SNAKE_CASE	:		Optional[Any]=2     ,    SCREAMING_SNAKE_CASE	:		List[str]=0.02     ,    SCREAMING_SNAKE_CASE	:		List[str]=1e-1_2     ,    SCREAMING_SNAKE_CASE	:		List[str]=True     ,    SCREAMING_SNAKE_CASE	:		Any=0     ,    SCREAMING_SNAKE_CASE	:		List[Any]=1     ,    SCREAMING_SNAKE_CASE	:		Union[str, Any]=2     ,    SCREAMING_SNAKE_CASE	:		Optional[Any]=6_6     ,    SCREAMING_SNAKE_CASE	:		Optional[Any]="block_sparse"     ,    SCREAMING_SNAKE_CASE	:		List[str]=True     ,    SCREAMING_SNAKE_CASE	:		Any=False     ,    SCREAMING_SNAKE_CASE	:		Union[str, Any]=6_4     ,    SCREAMING_SNAKE_CASE	:		Optional[Any]=3     ,    SCREAMING_SNAKE_CASE	:		int=None     ,    **SCREAMING_SNAKE_CASE	:		int     ,    )			->	Tuple:




											'''simple docstring'''

											super().__init__(
											    pad_token_id=SCREAMING_SNAKE_CASE     ,    bos_token_id=SCREAMING_SNAKE_CASE     ,    eos_token_id=SCREAMING_SNAKE_CASE     ,    sep_token_id=SCREAMING_SNAKE_CASE     ,    **SCREAMING_SNAKE_CASE     ,    )

											__snake_case				=		vocab_size
											__snake_case				=		max_position_embeddings
											__snake_case				=		hidden_size
											__snake_case				=		num_hidden_layers
											__snake_case				=		num_attention_heads
											__snake_case				=		intermediate_size
											__snake_case				=		hidden_act
											__snake_case				=		hidden_dropout_prob
											__snake_case				=		attention_probs_dropout_prob
											__snake_case				=		initializer_range
											__snake_case				=		type_vocab_size
											__snake_case				=		layer_norm_eps
											__snake_case				=		use_cache

											__snake_case				=		rescale_embeddings
											__snake_case				=		attention_type
											__snake_case				=		use_bias
											__snake_case				=		block_size
											__snake_case				=		num_random_blocks
											__snake_case				=		classifier_dropout






class     UpperCamelCase(  _a   ):


					@property
					def 							SCREAMING_SNAKE_CASE_  (						self	:		Optional[Any]						)			->	Mapping[str, Mapping[int, str]]:




											'''simple docstring'''

											if self.task == "multiple-choice":
																	__snake_case				=		{0: "batch", 1: "choice", 2: "sequence"}
											else:
																	__snake_case				=		{0: "batch", 1: "sequence"}
											return OrderedDict(
											    [
											        ("input_ids", dynamic_axis),
											        ("attention_mask", dynamic_axis),
											    ]						)









class     UpperCamelCase:


					def __init__(						self	:		Any						)			->	Any:




											'''simple docstring'''

											__snake_case				=		0
											__snake_case				=		0
											__snake_case				=		{}


					def 							SCREAMING_SNAKE_CASE_  (						self	:		Dict     ,    SCREAMING_SNAKE_CASE	:		Optional[int]						)			->	Optional[Any]:




											'''simple docstring'''

											if vertex not in self.adjacency:
																	__snake_case				=		{}
																	self.num_vertices += 1


					def 							SCREAMING_SNAKE_CASE_  (						self	:		Union[str, Any]     ,    SCREAMING_SNAKE_CASE	:		Optional[int]     ,    SCREAMING_SNAKE_CASE	:		Optional[int]     ,    SCREAMING_SNAKE_CASE	:		str						)			->	Optional[Any]:




											'''simple docstring'''

											self.add_vertex(SCREAMING_SNAKE_CASE						)
											self.add_vertex(SCREAMING_SNAKE_CASE						)

											if head == tail:
																	return

											__snake_case				=		weight
											__snake_case				=		weight


					def 							SCREAMING_SNAKE_CASE_  (						self	:		Optional[int]						)			->	Tuple:




											'''simple docstring'''

											__snake_case				=		self.get_edges()
											for edge in edges:
																	__snake_case		,					__snake_case		,					__snake_case				=		edge
																	edges.remove((tail, head, weight)						)
											for i in range(len(SCREAMING_SNAKE_CASE						)						):
																	__snake_case				=		list(edges[i]						)

											edges.sort(key=lambda SCREAMING_SNAKE_CASE						: e[2]						)
											for i in range(len(SCREAMING_SNAKE_CASE						) - 1						):
																	if edges[i][2] >= edges[i + 1][2]:
																							__snake_case				=		edges[i][2] + 1
											for edge in edges:
																	__snake_case		,					__snake_case		,					__snake_case				=		edge
																	__snake_case				=		weight
																	__snake_case				=		weight


					def __str__(						self	:		Tuple						)			->	List[Any]:




											'''simple docstring'''

											__snake_case				=		""
											for tail in self.adjacency:
																	for head in self.adjacency[tail]:
																							__snake_case				=		self.adjacency[head][tail]
																							string += f'''{head} -> {tail} == {weight}\n'''
											return string.rstrip("\n"						)


					def 							SCREAMING_SNAKE_CASE_  (						self	:		int						)			->	Optional[Any]:




											'''simple docstring'''

											__snake_case				=		[]
											for tail in self.adjacency:
																	for head in self.adjacency[tail]:
																							output.append((tail, head, self.adjacency[head][tail])						)
											return output


					def 							SCREAMING_SNAKE_CASE_  (						self	:		Any						)			->	List[Any]:




											'''simple docstring'''

											return self.adjacency.keys()


					@staticmethod
					def 							SCREAMING_SNAKE_CASE_  (						SCREAMING_SNAKE_CASE	:		Any=None     ,    SCREAMING_SNAKE_CASE	:		List[Any]=None						)			->	int:




											'''simple docstring'''

											__snake_case				=		Graph()
											if vertices is None:
																	__snake_case				=		[]
											if edges is None:
																	__snake_case				=		[]
											for vertex in vertices:
																	g.add_vertex(SCREAMING_SNAKE_CASE						)
											for edge in edges:
																	g.add_edge(*SCREAMING_SNAKE_CASE						)
											return g






					class     UpperCamelCase:


										def __init__(						self	:		Union[str, Any]						)			->	Union[str, Any]:




																'''simple docstring'''

																__snake_case				=		{}
																__snake_case				=		{}


										def __len__(						self	:		List[str]						)			->	Dict:




																'''simple docstring'''

																return len(self.parent						)


										def 							SCREAMING_SNAKE_CASE_  (						self	:		List[str]     ,    SCREAMING_SNAKE_CASE	:		int						)			->	List[str]:




																'''simple docstring'''

																if item in self.parent:
																						return self.find(SCREAMING_SNAKE_CASE						)

																__snake_case				=		item
																__snake_case				=		0
																return item


										def 							SCREAMING_SNAKE_CASE_  (						self	:		Optional[Any]     ,    SCREAMING_SNAKE_CASE	:		List[str]						)			->	Any:




																'''simple docstring'''

																if item not in self.parent:
																						return self.make_set(SCREAMING_SNAKE_CASE						)
																if item != self.parent[item]:
																						__snake_case				=		self.find(self.parent[item]						)
																return self.parent[item]






										def 							SCREAMING_SNAKE_CASE_  (						self	:		Optional[Any]     ,    SCREAMING_SNAKE_CASE	:		int     ,    SCREAMING_SNAKE_CASE	:		Union[str, Any]						)			->	Dict:




																'''simple docstring'''

																__snake_case				=		self.find(SCREAMING_SNAKE_CASE						)
																__snake_case				=		self.find(SCREAMING_SNAKE_CASE						)

																if roota == roota:
																						return roota

																if self.rank[roota] > self.rank[roota]:
																						__snake_case				=		roota
																						return roota

																if self.rank[roota] < self.rank[roota]:
																						__snake_case				=		roota
																						return roota

																if self.rank[roota] == self.rank[roota]:
																						self.rank[roota] += 1
																						__snake_case				=		roota
																						return roota
																return None




					@staticmethod
					def 							SCREAMING_SNAKE_CASE_  (						SCREAMING_SNAKE_CASE	:		str						)			->	Any:




											'''simple docstring'''

											__snake_case				=		graph.num_vertices

											__snake_case				=		Graph.UnionFind()
											__snake_case				=		[]
											while num_components > 1:
																	__snake_case				=		{}
																	for vertex in graph.get_vertices():
																							__snake_case				=		-1

																	__snake_case				=		graph.get_edges()
																	for edge in edges:
																							__snake_case		,					__snake_case		,					__snake_case				=		edge
																							edges.remove((tail, head, weight)						)
																	for edge in edges:
																							__snake_case		,					__snake_case		,					__snake_case				=		edge
																							__snake_case				=		union_find.find(SCREAMING_SNAKE_CASE						)
																							__snake_case				=		union_find.find(SCREAMING_SNAKE_CASE						)
																							if seta != seta:
																													if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
																																			__snake_case				=		[head, tail, weight]

																													if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
																																			__snake_case				=		[head, tail, weight]
																	for vertex in cheap_edge:
																							if cheap_edge[vertex] != -1:
																													__snake_case		,					__snake_case		,					__snake_case				=		cheap_edge[vertex]
																													if union_find.find(SCREAMING_SNAKE_CASE						) != union_find.find(SCREAMING_SNAKE_CASE						):
																																			union_find.union(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE						)
																																			mst_edges.append(cheap_edge[vertex]						)
																																			__snake_case				=		num_components - 1
											__snake_case				=		Graph.build(edges=SCREAMING_SNAKE_CASE						)
											return mst





