




from collections import OrderedDict
from typing import Mapping

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


__magic_name__     :     Optional[int]  							=					logging.get_logger(__name__)

__magic_name__     :     Union[str, Any]  							=					{
    """google/mobilebert-uncased""": """https://huggingface.co/google/mobilebert-uncased/resolve/main/config.json"""
}





class 						SCREAMING_SNAKE_CASE__		(_a ):
     lowercase_   :			List[Any]   =   MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP
     lowercase_   :			List[str]   =   "mobilebert"
     def __init__(	self  :		Tuple					,	__lowerCamelCase  :		List[str]=3_05_22					,	__lowerCamelCase  :		Any=5_12					,	__lowerCamelCase  :		List[str]=24					,	__lowerCamelCase  :		List[str]=4					,	__lowerCamelCase  :		str=5_12					,	__lowerCamelCase  :		Dict="relu"					,	__lowerCamelCase  :		str=0.0					,	__lowerCamelCase  :		Tuple=0.1					,	__lowerCamelCase  :		Dict=5_12					,	__lowerCamelCase  :		str=2					,	__lowerCamelCase  :		int=0.02					,	__lowerCamelCase  :		Union[str, Any]=1e-12					,	__lowerCamelCase  :		Optional[Any]=0					,	__lowerCamelCase  :		Tuple=1_28					,	__lowerCamelCase  :		Any=True					,	__lowerCamelCase  :		Optional[int]=True					,	__lowerCamelCase  :		str=1_28					,	__lowerCamelCase  :		str=False					,	__lowerCamelCase  :		Tuple=True					,	__lowerCamelCase  :		Tuple=4					,	__lowerCamelCase  :		List[str]="no_norm"					,	__lowerCamelCase  :		List[str]=True					,	__lowerCamelCase  :		int=None					,	**__lowerCamelCase  :		List[str]					,	):



       """simple docstring"""
       super().__init__(pad_token_id=__lowerCamelCase					,	**__lowerCamelCase	)

       lowerCAmelCase__								=			vocab_size
       lowerCAmelCase__								=			hidden_size
       lowerCAmelCase__								=			num_hidden_layers
       lowerCAmelCase__								=			num_attention_heads
       lowerCAmelCase__								=			hidden_act
       lowerCAmelCase__								=			intermediate_size
       lowerCAmelCase__								=			hidden_dropout_prob
       lowerCAmelCase__								=			attention_probs_dropout_prob
       lowerCAmelCase__								=			max_position_embeddings
       lowerCAmelCase__								=			type_vocab_size
       lowerCAmelCase__								=			initializer_range
       lowerCAmelCase__								=			layer_norm_eps
       lowerCAmelCase__								=			embedding_size
       lowerCAmelCase__								=			trigram_input
       lowerCAmelCase__								=			use_bottleneck
       lowerCAmelCase__								=			intra_bottleneck_size
       lowerCAmelCase__								=			use_bottleneck_attention
       lowerCAmelCase__								=			key_query_shared_bottleneck
       lowerCAmelCase__								=			num_feedforward_networks
       lowerCAmelCase__								=			normalization_type
       lowerCAmelCase__								=			classifier_activation

       if self.use_bottleneck:
         lowerCAmelCase__								=			intra_bottleneck_size
       else:
         lowerCAmelCase__								=			hidden_size

       lowerCAmelCase__								=			classifier_dropout





class 						SCREAMING_SNAKE_CASE__		(_a ):
     @property
     def 					A__			(	self  :		Optional[Any]	):



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







import os

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


__magic_name__     :     str  							=					logging.get_logger(__name__)





class 						SCREAMING_SNAKE_CASE__		(_a ):
     def __init__(	self  :		Any					,	__lowerCamelCase  :		Any					,	__lowerCamelCase  :		Optional[int]=None	):



       """simple docstring"""
       lowerCAmelCase__								=			language
       lowerCAmelCase__								=			train_language
     def 					A__			(	self  :		str					,	__lowerCamelCase  :		List[str]	):



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



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



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



__magic_name__     :     Tuple  							=					{
    """xnli""": XnliProcessor,
}

__magic_name__     :     List[Any]  							=					{
    """xnli""": """classification""",
}

__magic_name__     :     str  							=					{
    """xnli""": 3,
}

