





import os

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


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






class 	UpperCamelCase_     (     snake_case__       ):



					def __init__(		self    :    Tuple					,			lowerCamelCase    :    Optional[int]					,			lowerCamelCase    :    Optional[int]=None	):
							lowerCamelCase_  :    Dict   	=			language
							lowerCamelCase_  :    Optional[int]   	=			train_language



					def      __a    (		self    :    int					,			lowerCamelCase    :    Optional[Any]	):
							lowerCamelCase_  :    Optional[int]   	=			self.language if self.train_language is None else self.train_language
							lowerCamelCase_  :    Tuple   	=			self._read_tsv(os.path.join(lowerCamelCase					,			F"XNLI-MT-1.0/multinli/multinli.train.{lg}.tsv"	)	)
							lowerCamelCase_  :    Tuple   	=			[]
							for i, line in enumerate(lowerCamelCase	):
									if i == 0:
											continue
									lowerCamelCase_  :    Any   	=			F"train-{i}"
									lowerCamelCase_  :    Union[str, Any]   	=			line[0]
									lowerCamelCase_  :    Optional[int]   	=			line[1]
									lowerCamelCase_  :    str   	=			'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      __a    (		self    :    Dict					,			lowerCamelCase    :    Optional[Any]	):
							lowerCamelCase_  :    List[Any]   	=			self._read_tsv(os.path.join(lowerCamelCase					,			'XNLI-1.0/xnli.test.tsv'	)	)
							lowerCamelCase_  :    Tuple   	=			[]
							for i, line in enumerate(lowerCamelCase	):
									if i == 0:
											continue
									lowerCamelCase_  :    Tuple   	=			line[0]
									if language != self.language:
											continue
									lowerCamelCase_  :    Optional[int]   	=			F"test-{i}"
									lowerCamelCase_  :    List[Any]   	=			line[6]
									lowerCamelCase_  :    str   	=			line[7]
									lowerCamelCase_  :    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      __a    (		self    :    Union[str, Any]	):
							return ["contradiction", "entailment", "neutral"]
_lowercase		:     int 					={
    """xnli""": XnliProcessor,
}

_lowercase		:     Union[str, Any] 					={
    """xnli""": """classification""",
}

_lowercase		:     int 					={
    """xnli""": 3,
}







from typing import TYPE_CHECKING

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


_lowercase		:     int 					={
    """configuration_marian""": ["""MARIAN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MarianConfig""", """MarianOnnxConfig"""],
}

try:
		if not is_sentencepiece_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_lowercase		:     Any 					=["""MarianTokenizer"""]

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_lowercase		:     Any 					=[
		    """MARIAN_PRETRAINED_MODEL_ARCHIVE_LIST""",
		    """MarianForCausalLM""",
		    """MarianModel""",
		    """MarianMTModel""",
		    """MarianPreTrainedModel""",
		]

try:
		if not is_tf_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_lowercase		:     Dict 					=["""TFMarianModel""", """TFMarianMTModel""", """TFMarianPreTrainedModel"""]

try:
		if not is_flax_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_lowercase		:     Optional[Any] 					=["""FlaxMarianModel""", """FlaxMarianMTModel""", """FlaxMarianPreTrainedModel"""]

if TYPE_CHECKING:
		from .configuration_marian import MARIAN_PRETRAINED_CONFIG_ARCHIVE_MAP, MarianConfig, MarianOnnxConfig

		try:
				if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_marian import MarianTokenizer

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_marian import (
				    MARIAN_PRETRAINED_MODEL_ARCHIVE_LIST,
				    MarianForCausalLM,
				    MarianModel,
				    MarianMTModel,
				    MarianPreTrainedModel,
				)

		try:
				if not is_tf_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_tf_marian import TFMarianModel, TFMarianMTModel, TFMarianPreTrainedModel

		try:
				if not is_flax_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_flax_marian import FlaxMarianModel, FlaxMarianMTModel, FlaxMarianPreTrainedModel

else:
		import sys

		_lowercase		:     List[str] 					=_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)
