
"""simple docstring"""
import os

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


lowercase		:						Tuple =					logging.get_logger(__name__)




class    _snake_case  (						_lowercase       ):






							def __init__(					self						:			Optional[int]						, snake_case__						:			int						, snake_case__						:			int=None    ):






												"""simple docstring"""



												__a:						Union[str, Any]		    =					language
												__a:						int		    =					train_language






							def 							__lowercase  (					self						:			Optional[Any]						, snake_case__						:			Tuple    ):






												"""simple docstring"""



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






							def 							__lowercase  (					self						:			Dict						, snake_case__						:			Optional[int]    ):






												"""simple docstring"""



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






							def 							__lowercase  (					self						:			Tuple    ):






												"""simple docstring"""



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






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

lowercase		:						Any =					{
    'xnli': 'classification',
}

lowercase		:						Optional[Any] =					{
    'xnli': 3,
}


"""simple docstring"""
from typing import TYPE_CHECKING

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


lowercase		:						List[str] =					{
    'configuration_open_llama': ['OPEN_LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'OpenLlamaConfig'],
}

try:
			if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			lowercase		:						Tuple =					['LlamaTokenizer']

try:
			if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			lowercase		:						Dict =					['LlamaTokenizerFast']

try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			lowercase		:						List[Any] =					[
			    'OpenLlamaForCausalLM',
			    'OpenLlamaModel',
			    'OpenLlamaPreTrainedModel',
			    'OpenLlamaForSequenceClassification',
			]


if TYPE_CHECKING:
			from .configuration_open_llama import OPEN_LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP, OpenLlamaConfig

			try:
						if not is_sentencepiece_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from transformers import LlamaTokenizer

			try:
						if not is_tokenizers_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from transformers import LlamaTokenizerFast

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_open_llama import (
						    OpenLlamaForCausalLM,
						    OpenLlamaForSequenceClassification,
						    OpenLlamaModel,
						    OpenLlamaPreTrainedModel,
						)


else:
			import sys

			lowercase		:						Dict =					_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)
