





"""simple docstring"""




import os

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


UpperCamelCase_	 =logging.get_logger(__name__)




class 					_a		( _lowerCAmelCase							):






				def __init__(					self						:       List[str],					lowerCAmelCase__						:       List[Any],					lowerCAmelCase__						:       Tuple=None				)      -> int:




										'''simple docstring'''



										_UpperCamelCase     :   Optional[int]      =       language
										_UpperCamelCase     :   Dict      =       train_language






				def 							snake_case      (					self						:       Optional[int],					lowerCAmelCase__						:       Any				)      -> int:




										'''simple docstring'''



										_UpperCamelCase     :   List[Any]      =       self.language if self.train_language is None else self.train_language
										_UpperCamelCase     :   Optional[int]      =       self._read_tsv(os.path.join(lowerCAmelCase__,					f"""XNLI-MT-1.0/multinli/multinli.train.{lg}.tsv"""				)				)
										_UpperCamelCase     :   List[str]      =       []
										for i, line in enumerate(lowerCAmelCase__				):
																if i == 0:
																						continue
																_UpperCamelCase     :   str      =       f"""train-{i}"""
																_UpperCamelCase     :   Union[str, Any]      =       line[0]
																_UpperCamelCase     :   Dict      =       line[1]
																_UpperCamelCase     :   Dict      =       '''contradiction''' if line[2] == '''contradictory''' else line[2]
																if not isinstance(lowerCAmelCase__,					lowerCAmelCase__				):
																						raise ValueError(f"""Training input {text_a} is not a string"""				)
																if not isinstance(lowerCAmelCase__,					lowerCAmelCase__				):
																						raise ValueError(f"""Training input {text_b} is not a string"""				)
																if not isinstance(lowerCAmelCase__,					lowerCAmelCase__				):
																						raise ValueError(f"""Training label {label} is not a string"""				)
																examples.append(InputExample(guid=lowerCAmelCase__,					text_a=lowerCAmelCase__,					text_b=lowerCAmelCase__,					label=lowerCAmelCase__				)				)
										return examples






				def 							snake_case      (					self						:       Any,					lowerCAmelCase__						:       int				)      -> str:




										'''simple docstring'''



										_UpperCamelCase     :   Union[str, Any]      =       self._read_tsv(os.path.join(lowerCAmelCase__,					'''XNLI-1.0/xnli.test.tsv'''				)				)
										_UpperCamelCase     :   List[Any]      =       []
										for i, line in enumerate(lowerCAmelCase__				):
																if i == 0:
																						continue
																_UpperCamelCase     :   Optional[Any]      =       line[0]
																if language != self.language:
																						continue
																_UpperCamelCase     :   Optional[int]      =       f"""test-{i}"""
																_UpperCamelCase     :   Optional[int]      =       line[6]
																_UpperCamelCase     :   Union[str, Any]      =       line[7]
																_UpperCamelCase     :   Dict      =       line[1]
																if not isinstance(lowerCAmelCase__,					lowerCAmelCase__				):
																						raise ValueError(f"""Training input {text_a} is not a string"""				)
																if not isinstance(lowerCAmelCase__,					lowerCAmelCase__				):
																						raise ValueError(f"""Training input {text_b} is not a string"""				)
																if not isinstance(lowerCAmelCase__,					lowerCAmelCase__				):
																						raise ValueError(f"""Training label {label} is not a string"""				)
																examples.append(InputExample(guid=lowerCAmelCase__,					text_a=lowerCAmelCase__,					text_b=lowerCAmelCase__,					label=lowerCAmelCase__				)				)
										return examples






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




										'''simple docstring'''



										return ["contradiction", "entailment", "neutral"]

UpperCamelCase_	 ={
    """xnli""": XnliProcessor,
}

UpperCamelCase_	 ={
    """xnli""": """classification""",
}

UpperCamelCase_	 ={
    """xnli""": 3,
}




'''simple docstring'''




from transformers import HfArgumentParser, PyTorchBenchmark, PyTorchBenchmarkArguments




def 				lowerCamelCase      ( )     -> List[Any]:
							lowercase_   :     Tuple									=			HfArgumentParser(UpperCAmelCase__					)
							try:
														lowercase_   :     List[Any]									=			parser.parse_args_into_dataclasses()[0]
							except ValueError as e:
														lowercase_   :     int									=			"""Arg --no_{0} is no longer used, please use --no-{0} instead."""
														lowercase_   :     Any									=			""" """.join(str(UpperCAmelCase__					).split(""" """					)[:-1]					)
														lowercase_   :     Optional[Any]									=			""""""
														lowercase_   :     List[str]									=			eval(str(UpperCAmelCase__					).split(""" """					)[-1]					)
														lowercase_   :     Dict									=			[]
														for arg in depreciated_args:
																					# arg[2:] removes '--'
																					if arg[2:] in PyTorchBenchmarkArguments.deprecated_args:
																												# arg[5:] removes '--no_'
																												full_error_msg += arg_error_msg.format(arg[5:]					)
																					else:
																												wrong_args.append(UpperCAmelCase__					)
														if len(UpperCAmelCase__					) > 0:
																					lowercase_   :     Dict									=			full_error_msg + begin_error_msg + str(UpperCAmelCase__					)
														raise ValueError(UpperCAmelCase__					)

							lowercase_   :     Optional[int]									=			PyTorchBenchmark(args=UpperCAmelCase__					)
							benchmark.run()


if __name__ == "__main__":
						main()





