





"""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 typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


SCREAMING_SNAKE_CASE					:       Union[str, Any]							   =							{
    """configuration_bart""": ["""BART_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BartConfig""", """BartOnnxConfig"""],
    """tokenization_bart""": ["""BartTokenizer"""],
}

try:
			if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			SCREAMING_SNAKE_CASE					:       Dict							   =							["""BartTokenizerFast"""]

try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			SCREAMING_SNAKE_CASE					:       List[Any]							   =							[
			    """BART_PRETRAINED_MODEL_ARCHIVE_LIST""",
			    """BartForCausalLM""",
			    """BartForConditionalGeneration""",
			    """BartForQuestionAnswering""",
			    """BartForSequenceClassification""",
			    """BartModel""",
			    """BartPretrainedModel""",
			    """PretrainedBartModel""",
			]

try:
			if not is_tf_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			SCREAMING_SNAKE_CASE					:       Any							   =							[
			    """TFBartForConditionalGeneration""",
			    """TFBartForSequenceClassification""",
			    """TFBartModel""",
			    """TFBartPretrainedModel""",
			]

try:
			if not is_flax_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			SCREAMING_SNAKE_CASE					:       str							   =							[
			    """FlaxBartDecoderPreTrainedModel""",
			    """FlaxBartForCausalLM""",
			    """FlaxBartForConditionalGeneration""",
			    """FlaxBartForQuestionAnswering""",
			    """FlaxBartForSequenceClassification""",
			    """FlaxBartModel""",
			    """FlaxBartPreTrainedModel""",
			]

if TYPE_CHECKING:
			from .configuration_bart import BART_PRETRAINED_CONFIG_ARCHIVE_MAP, BartConfig, BartOnnxConfig
			from .tokenization_bart import BartTokenizer

			try:
						if not is_tokenizers_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .tokenization_bart_fast import BartTokenizerFast

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_bart import (
						    BART_PRETRAINED_MODEL_ARCHIVE_LIST,
						    BartForCausalLM,
						    BartForConditionalGeneration,
						    BartForQuestionAnswering,
						    BartForSequenceClassification,
						    BartModel,
						    BartPretrainedModel,
						    PretrainedBartModel,
						)

			try:
						if not is_tf_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_tf_bart import (
						    TFBartForConditionalGeneration,
						    TFBartForSequenceClassification,
						    TFBartModel,
						    TFBartPretrainedModel,
						)

			try:
						if not is_flax_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_flax_bart import (
						    FlaxBartDecoderPreTrainedModel,
						    FlaxBartForCausalLM,
						    FlaxBartForConditionalGeneration,
						    FlaxBartForQuestionAnswering,
						    FlaxBartForSequenceClassification,
						    FlaxBartModel,
						    FlaxBartPreTrainedModel,
						)

else:
			import sys

			SCREAMING_SNAKE_CASE					:       Tuple							   =							_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)





