



'''simple docstring'''
from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


snake_case_				:			Any						 =						logging.get_logger(__name__)

snake_case_				:			Optional[Any]						 =						{
    'google/mobilebert-uncased': 'https://huggingface.co/google/mobilebert-uncased/resolve/main/config.json'
}






class 							lowercase__			(							lowercase     ):
	lowercase__						       =    MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP
	lowercase__						       =    """mobilebert"""





	def __init__(				self      :       Optional[int]				,lowerCamelCase__      :       str=30522				,lowerCamelCase__      :       Any=512				,lowerCamelCase__      :       List[Any]=24				,lowerCamelCase__      :       Dict=4				,lowerCamelCase__      :       str=512				,lowerCamelCase__      :       Union[str, Any]="relu"				,lowerCamelCase__      :       Dict=0.0				,lowerCamelCase__      :       str=0.1				,lowerCamelCase__      :       Dict=512				,lowerCamelCase__      :       Optional[Any]=2				,lowerCamelCase__      :       int=0.0_2				,lowerCamelCase__      :       str=1E-12				,lowerCamelCase__      :       int=0				,lowerCamelCase__      :       Any=128				,lowerCamelCase__      :       Dict=True				,lowerCamelCase__      :       Any=True				,lowerCamelCase__      :       Tuple=128				,lowerCamelCase__      :       Optional[Any]=False				,lowerCamelCase__      :       List[str]=True				,lowerCamelCase__      :       Any=4				,lowerCamelCase__      :       List[str]="no_norm"				,lowerCamelCase__      :       List[str]=True				,lowerCamelCase__      :       Optional[Any]=None				,**lowerCamelCase__      :       str				,):







							'''simple docstring'''
							super().__init__(pad_token_id=lowerCamelCase__				,**lowerCamelCase__				)

							_UpperCamelCase      :	Optional[int]				       =     vocab_size
							_UpperCamelCase      :	List[Any]				       =     hidden_size
							_UpperCamelCase      :	Optional[Any]				       =     num_hidden_layers
							_UpperCamelCase      :	List[Any]				       =     num_attention_heads
							_UpperCamelCase      :	List[str]				       =     hidden_act
							_UpperCamelCase      :	Optional[Any]				       =     intermediate_size
							_UpperCamelCase      :	str				       =     hidden_dropout_prob
							_UpperCamelCase      :	Dict				       =     attention_probs_dropout_prob
							_UpperCamelCase      :	List[str]				       =     max_position_embeddings
							_UpperCamelCase      :	List[str]				       =     type_vocab_size
							_UpperCamelCase      :	Dict				       =     initializer_range
							_UpperCamelCase      :	Union[str, Any]				       =     layer_norm_eps
							_UpperCamelCase      :	str				       =     embedding_size
							_UpperCamelCase      :	Union[str, Any]				       =     trigram_input
							_UpperCamelCase      :	List[str]				       =     use_bottleneck
							_UpperCamelCase      :	List[Any]				       =     intra_bottleneck_size
							_UpperCamelCase      :	List[str]				       =     use_bottleneck_attention
							_UpperCamelCase      :	List[Any]				       =     key_query_shared_bottleneck
							_UpperCamelCase      :	Dict				       =     num_feedforward_networks
							_UpperCamelCase      :	Optional[int]				       =     normalization_type
							_UpperCamelCase      :	Any				       =     classifier_activation

							if self.use_bottleneck:
													_UpperCamelCase      :	Optional[int]				       =     intra_bottleneck_size
							else:
													_UpperCamelCase      :	List[Any]				       =     hidden_size

							_UpperCamelCase      :	Dict				       =     classifier_dropout






class 							lowercase__			(							lowercase     ):





	@property
	def 			UpperCamelCase_						(				self      :       str				):







							'''simple docstring'''
							if self.task == "multiple-choice":
													_UpperCamelCase      :	List[str]				       =     {0: 'batch', 1: 'choice', 2: 'sequence'}
							else:
													_UpperCamelCase      :	int				       =     {0: 'batch', 1: 'sequence'}
							return OrderedDict(
							    [
							        ('input_ids', dynamic_axis),
							        ('attention_mask', dynamic_axis),
							        ('token_type_ids', dynamic_axis),
							    ]				)







'''simple docstring'''
import os

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


snake_case_				:			Any						 =						logging.get_logger(__name__)






class 							lowercase__			(							lowercase     ):





	def __init__(				self      :       Union[str, Any]				,lowerCamelCase__      :       Tuple				,lowerCamelCase__      :       Optional[int]=None				):







							'''simple docstring'''
							_UpperCamelCase      :	Any				       =     language
							_UpperCamelCase      :	int				       =     train_language





	def 			UpperCamelCase_						(				self      :       Optional[int]				,lowerCamelCase__      :       Dict				):







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







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







							'''simple docstring'''
							return ["contradiction", "entailment", "neutral"]
snake_case_				:			int						 =						{
    'xnli': XnliProcessor,
}

snake_case_				:			Tuple						 =						{
    'xnli': 'classification',
}

snake_case_				:			Any						 =						{
    'xnli': 3,
}


