

"""simple docstring"""




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


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

__A  :					List[str]												=	{
    # pcqm4mv1 now deprecated
    'graphormer-base': 'https://huggingface.co/clefourrier/graphormer-base-pcqm4mv2/resolve/main/config.json',
    # See all Graphormer models at https://huggingface.co/models?filter=graphormer
}





class     __UpperCamelCase				(     _A		):
		SCREAMING_SNAKE_CASE              =					"graphormer"
		SCREAMING_SNAKE_CASE              =					["past_key_values"]


		def __init__(self				:	Dict  ,  __SCREAMING_SNAKE_CASE				:	int = 1  ,  __SCREAMING_SNAKE_CASE				:	int = 5_1_2 * 9  ,  __SCREAMING_SNAKE_CASE				:	int = 5_1_2 * 3  ,  __SCREAMING_SNAKE_CASE				:	int = 5_1_2  ,  __SCREAMING_SNAKE_CASE				:	int = 5_1_2  ,  __SCREAMING_SNAKE_CASE				:	int = 5_1_2  ,  __SCREAMING_SNAKE_CASE				:	int = 1_2_8  ,  __SCREAMING_SNAKE_CASE				:	int = 5  ,  __SCREAMING_SNAKE_CASE				:	int = 1_0_2_4  ,  __SCREAMING_SNAKE_CASE				:	str = "multi_hop"  ,  __SCREAMING_SNAKE_CASE				:	int = 5_1_2  ,  __SCREAMING_SNAKE_CASE				:	bool = False  ,  __SCREAMING_SNAKE_CASE				:	int = 1_2  ,  __SCREAMING_SNAKE_CASE				:	int = 7_6_8  ,  __SCREAMING_SNAKE_CASE				:	int = 7_6_8  ,  __SCREAMING_SNAKE_CASE				:	int = 3_2  ,  __SCREAMING_SNAKE_CASE				:	float = 0.1  ,  __SCREAMING_SNAKE_CASE				:	float = 0.1  ,  __SCREAMING_SNAKE_CASE				:	float = 0.0  ,  __SCREAMING_SNAKE_CASE				:	bool = False  ,  __SCREAMING_SNAKE_CASE				:	bool = False  ,  __SCREAMING_SNAKE_CASE				:	bool = False  ,  __SCREAMING_SNAKE_CASE				:	str = "gelu"  ,  __SCREAMING_SNAKE_CASE				:	float = None  ,  __SCREAMING_SNAKE_CASE				:	bool = False  ,  __SCREAMING_SNAKE_CASE				:	int = 0  ,  __SCREAMING_SNAKE_CASE				:	bool = False  ,  __SCREAMING_SNAKE_CASE				:	float = 0.0  ,  __SCREAMING_SNAKE_CASE				:	int = 8  ,  __SCREAMING_SNAKE_CASE				:	int = None  ,  __SCREAMING_SNAKE_CASE				:	int = None  ,  __SCREAMING_SNAKE_CASE				:	bool = True  ,  __SCREAMING_SNAKE_CASE				:	bool = True  ,  __SCREAMING_SNAKE_CASE				:	Union[str, Any]=0  ,  __SCREAMING_SNAKE_CASE				:	Dict=1  ,  __SCREAMING_SNAKE_CASE				:	int=2  ,  **__SCREAMING_SNAKE_CASE				:	List[str]  ,  ):
							A    =      num_classes
							A    =      num_atoms
							A    =      num_in_degree
							A    =      num_out_degree
							A    =      num_edges
							A    =      num_spatial
							A    =      num_edge_dis
							A    =      edge_type
							A    =      multi_hop_max_dist
							A    =      spatial_pos_max
							A    =      max_nodes
							A    =      num_hidden_layers
							A    =      embedding_dim
							A    =      embedding_dim
							A    =      ffn_embedding_dim
							A    =      num_attention_heads
							A    =      dropout
							A    =      attention_dropout
							A    =      layerdrop
							A    =      encoder_normalize_before
							A    =      pre_layernorm
							A    =      apply_graphormer_init
							A    =      activation_fn
							A    =      embed_scale
							A    =      freeze_embeddings
							A    =      num_trans_layers_to_freeze
							A    =      share_input_output_embed
							A    =      traceable
							A    =      q_noise
							A    =      qn_block_size

							# These parameters are here for future extensions
							# atm, the model only supports self attention
							A    =      kdim
							A    =      vdim
							A    =      self_attention
							A    =      bias

							super().__init__(
							    pad_token_id=__SCREAMING_SNAKE_CASE  ,  bos_token_id=__SCREAMING_SNAKE_CASE  ,  eos_token_id=__SCREAMING_SNAKE_CASE  ,  **__SCREAMING_SNAKE_CASE  ,  )








"""simple docstring"""




import os

from ...utils import logging
from .utils import DataProcessor, InputExample


__A  :					List[Any]												=	logging.get_logger(__name__)





class     __UpperCamelCase				(     _A		):


		def __init__(self				:	Dict  ,  __SCREAMING_SNAKE_CASE				:	int  ,  __SCREAMING_SNAKE_CASE				:	Any=None):
							A    =      language
							A    =      train_language


		def       SCREAMING_SNAKE_CASE__     (self				:	Tuple  ,  __SCREAMING_SNAKE_CASE				:	Tuple):
							A    =      self.language if self.train_language is None else self.train_language
							A    =      self._read_tsv(os.path.join(__SCREAMING_SNAKE_CASE  ,  F"""XNLI-MT-1.0/multinli/multinli.train.{lg}.tsv"""))
							A    =      []
							for i, line in enumerate(__SCREAMING_SNAKE_CASE):
												if i == 0:
																	continue
												A    =      F"""train-{i}"""
												A    =      line[0]
												A    =      line[1]
												A    =      "contradiction" if line[2] == "contradictory" else line[2]
												if not isinstance(__SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE):
																	raise ValueError(F"""Training input {text_a} is not a string""")
												if not isinstance(__SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE):
																	raise ValueError(F"""Training input {text_b} is not a string""")
												if not isinstance(__SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE):
																	raise ValueError(F"""Training label {label} is not a string""")
												examples.append(InputExample(guid=__SCREAMING_SNAKE_CASE  ,  text_a=__SCREAMING_SNAKE_CASE  ,  text_b=__SCREAMING_SNAKE_CASE  ,  label=__SCREAMING_SNAKE_CASE))
							return examples


		def       SCREAMING_SNAKE_CASE__     (self				:	List[str]  ,  __SCREAMING_SNAKE_CASE				:	Tuple):
							A    =      self._read_tsv(os.path.join(__SCREAMING_SNAKE_CASE  ,  "XNLI-1.0/xnli.test.tsv"))
							A    =      []
							for i, line in enumerate(__SCREAMING_SNAKE_CASE):
												if i == 0:
																	continue
												A    =      line[0]
												if language != self.language:
																	continue
												A    =      F"""test-{i}"""
												A    =      line[6]
												A    =      line[7]
												A    =      line[1]
												if not isinstance(__SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE):
																	raise ValueError(F"""Training input {text_a} is not a string""")
												if not isinstance(__SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE):
																	raise ValueError(F"""Training input {text_b} is not a string""")
												if not isinstance(__SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE):
																	raise ValueError(F"""Training label {label} is not a string""")
												examples.append(InputExample(guid=__SCREAMING_SNAKE_CASE  ,  text_a=__SCREAMING_SNAKE_CASE  ,  text_b=__SCREAMING_SNAKE_CASE  ,  label=__SCREAMING_SNAKE_CASE))
							return examples


		def       SCREAMING_SNAKE_CASE__     (self				:	str):
							return ["contradiction", "entailment", "neutral"]

__A  :					Optional[int]												=	{
    'xnli': XnliProcessor,
}

__A  :					Union[str, Any]												=	{
    'xnli': 'classification',
}

__A  :					Tuple												=	{
    'xnli': 3,
}





