





import os

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


_snake_case				= logging.get_logger(__name__)





class 					lowerCAmelCase							(   lowercase_					):







  def __init__(			self  :Optional[Any]    ,							_lowercase  :Optional[Any]    ,							_lowercase  :List[Any]=None					):






     '''simple docstring'''





     lowercase__    =  language
     lowercase__    =  train_language







  def   UpperCAmelCase     (			self  :List[str]    ,							_lowercase  :int					):






     '''simple docstring'''





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







  def   UpperCAmelCase     (			self  :Tuple    ,							_lowercase  :Optional[Any]					):






     '''simple docstring'''





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







  def   UpperCAmelCase     (			self  :Tuple					):






     '''simple docstring'''





     return ["contradiction", "entailment", "neutral"]
_snake_case				= {
    """xnli""": XnliProcessor,
}

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

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













from typing import TYPE_CHECKING

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


_snake_case				= {"""configuration_regnet""": ["""REGNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """RegNetConfig"""]}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _snake_case				= [
      """REGNET_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """RegNetForImageClassification""",
      """RegNetModel""",
      """RegNetPreTrainedModel""",
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _snake_case				= [
      """TF_REGNET_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """TFRegNetForImageClassification""",
      """TFRegNetModel""",
      """TFRegNetPreTrainedModel""",
  ]

try:
  if not is_flax_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _snake_case				= [
      """FlaxRegNetForImageClassification""",
      """FlaxRegNetModel""",
      """FlaxRegNetPreTrainedModel""",
  ]


if TYPE_CHECKING:
  from .configuration_regnet import REGNET_PRETRAINED_CONFIG_ARCHIVE_MAP, RegNetConfig

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_regnet import (
        REGNET_PRETRAINED_MODEL_ARCHIVE_LIST,
        RegNetForImageClassification,
        RegNetModel,
        RegNetPreTrainedModel,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_regnet import (
        TF_REGNET_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFRegNetForImageClassification,
        TFRegNetModel,
        TFRegNetPreTrainedModel,
    )

  try:
    if not is_flax_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_flax_regnet import (
        FlaxRegNetForImageClassification,
        FlaxRegNetModel,
        FlaxRegNetPreTrainedModel,
    )


else:
  import sys

  _snake_case				= _LazyModule(__name__, globals()["""__file__"""], _import_structure)






