





import os

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


_lowerCamelCase       =	logging.get_logger(__name__)




class      UpperCamelCase_				(   UpperCamelCase__			):


							def __init__(							self			:Tuple							, __A			:List[Any]							, __A			:str=None						)      ->      Dict:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								=					language
									SCREAMING_SNAKE_CASE__								=					train_language


							def    _snake_case     (							self			:Tuple							, __A			:Optional[int]						)      ->      Any:



									"""simple docstring"""



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


							def    _snake_case     (							self			:Any							, __A			:Optional[int]						)      ->      Dict:



									"""simple docstring"""



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


							def    _snake_case     (							self			:Dict						)      ->      int:



									"""simple docstring"""



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



_lowerCamelCase       =	{
    'xnli': XnliProcessor,
}

_lowerCamelCase       =	{
    'xnli': 'classification',
}

_lowerCamelCase       =	{
    'xnli': 3,
}






'''simple docstring'''







import unittest
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import Mock, patch

import diffusers.utils.hub_utils





class     _UpperCAmelCase							(						unittest.TestCase   ):
		@patch("""diffusers.utils.hub_utils.get_full_repo_name"""			)
		def   lowerCamelCase__			(  self,__SCREAMING_SNAKE_CASE			):



					'''simple docstring'''

					__lowerCAmelCase											=				"""full_repo_name"""
					with TemporaryDirectory() as tmpdir:
								# Dummy args values
								__lowerCAmelCase											=				Mock()
								__lowerCAmelCase											=				tmpdir
								__lowerCAmelCase											=				0
								__lowerCAmelCase											=				"""hub_token"""
								__lowerCAmelCase											=				"""dataset_name"""
								__lowerCAmelCase											=				0.01
								__lowerCAmelCase											=				10_00_00
								__lowerCAmelCase											=				1_00_00
								__lowerCAmelCase											=				0.01
								__lowerCAmelCase											=				0.02
								__lowerCAmelCase											=				0.03
								__lowerCAmelCase											=				0.0005
								__lowerCAmelCase											=				0.00_0001
								__lowerCAmelCase											=				1
								__lowerCAmelCase											=				10
								__lowerCAmelCase											=				0.001
								__lowerCAmelCase											=				0.1
								__lowerCAmelCase											=				0.2
								__lowerCAmelCase											=				True

								# Model card mush be rendered and saved
								diffusers.utils.hub_utils.create_model_card(__SCREAMING_SNAKE_CASE,model_name="""model_name"""			)
								self.assertTrue((Path(__SCREAMING_SNAKE_CASE			) / """README.md""").is_file()			)

