





"""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,
}









from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCAmelCase_   							=      {'configuration_dinat': ['DINAT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'DinatConfig']}


try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       UpperCAmelCase_   							=      [
           'DINAT_PRETRAINED_MODEL_ARCHIVE_LIST',
           'DinatForImageClassification',
           'DinatModel',
           'DinatPreTrainedModel',
           'DinatBackbone',
       ]

if TYPE_CHECKING:
       from .configuration_dinat import DINAT_PRETRAINED_CONFIG_ARCHIVE_MAP, DinatConfig

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_dinat import (
                  DINAT_PRETRAINED_MODEL_ARCHIVE_LIST,
                  DinatBackbone,
                  DinatForImageClassification,
                  DinatModel,
                  DinatPreTrainedModel,
              )

else:
       import sys

       UpperCAmelCase_   							=      _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)

