





'''simple docstring'''

import os

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


UpperCAmelCase       :		Dict		=				logging.get_logger(__name__)





class lowerCamelCase    (a__       ):







  def __init__(		self  ,  lowercase__  ,  lowercase__=None		)		->    Optional[Any]:






        """simple docstring"""





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







  def 					UpperCAmelCase_					(		self  ,  lowercase__		)		->    Dict:






        """simple docstring"""





        _snake_case		:						Optional[int]         =  self.language if self.train_language is None else self.train_language
        _snake_case		:						Union[str, Any]         =  self._read_tsv(os.path.join(lowercase__  ,  F'''XNLI-MT-1.0/multinli/multinli.train.{lg}.tsv'''		)		)
        _snake_case		:						Optional[int]         =  []
        for i, line in enumerate(lowercase__		):
              if i == 0:
                    continue
              _snake_case		:						int         =  F'''train-{i}'''
              _snake_case		:						str         =  line[0]
              _snake_case		:						Any         =  line[1]
              _snake_case		:						List[Any]         =  '''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  ,  lowercase__		)		->    List[str]:






        """simple docstring"""





        _snake_case		:						Any         =  self._read_tsv(os.path.join(lowercase__  ,  '''XNLI-1.0/xnli.test.tsv'''		)		)
        _snake_case		:						Dict         =  []
        for i, line in enumerate(lowercase__		):
              if i == 0:
                    continue
              _snake_case		:						Optional[Any]         =  line[0]
              if language != self.language:
                    continue
              _snake_case		:						Optional[Any]         =  F'''test-{i}'''
              _snake_case		:						Optional[Any]         =  line[6]
              _snake_case		:						Optional[Any]         =  line[7]
              _snake_case		:						Dict         =  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		)		->    str:






        """simple docstring"""





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



UpperCAmelCase       :		Optional[Any]		=				{
    'xnli': XnliProcessor,
}

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

UpperCAmelCase       :		Union[str, Any]		=				{
    'xnli': 3,
}









'''simple docstring'''

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


UpperCAmelCase       :		Dict		=				{'configuration_hubert': ['HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'HubertConfig']}

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   UpperCAmelCase       :		Union[str, Any]		=				[
       'HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
       'HubertForCTC',
       'HubertForSequenceClassification',
       'HubertModel',
       'HubertPreTrainedModel',
   ]


try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   UpperCAmelCase       :		Optional[int]		=				[
       'TF_HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
       'TFHubertForCTC',
       'TFHubertModel',
       'TFHubertPreTrainedModel',
   ]

if TYPE_CHECKING:
   from .configuration_hubert import HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, HubertConfig

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_hubert import (
          HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
          HubertForCTC,
          HubertForSequenceClassification,
          HubertModel,
          HubertPreTrainedModel,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_hubert import (
          TF_HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
          TFHubertForCTC,
          TFHubertModel,
          TFHubertPreTrainedModel,
      )


else:
   import sys

   UpperCAmelCase       :		Optional[int]		=				_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)


