'''simple docstring'''

from collections import OrderedDict
from typing import Mapping

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


_lowerCamelCase :				Tuple														= logging.get_logger(__name__)

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




class    lowerCamelCase__  (   __snake_case     ):
   __UpperCAmelCase           =						MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP
   __UpperCAmelCase           =						"""mobilebert"""



   def __init__(    self					,      lowerCAmelCase__=30_522					,      lowerCAmelCase__=512					,      lowerCAmelCase__=24					,      lowerCAmelCase__=4					,      lowerCAmelCase__=512					,      lowerCAmelCase__="relu"					,      lowerCAmelCase__=0.0					,      lowerCAmelCase__=0.1					,      lowerCAmelCase__=512					,      lowerCAmelCase__=2					,      lowerCAmelCase__=0.02					,      lowerCAmelCase__=1e-12					,      lowerCAmelCase__=0					,      lowerCAmelCase__=128					,      lowerCAmelCase__=True					,      lowerCAmelCase__=True					,      lowerCAmelCase__=128					,      lowerCAmelCase__=False					,      lowerCAmelCase__=True					,      lowerCAmelCase__=4					,      lowerCAmelCase__="no_norm"					,      lowerCAmelCase__=True					,      lowerCAmelCase__=None					,      **lowerCAmelCase__					,      )				->     List[Any]:
        """simple docstring"""





        super().__init__(pad_token_id=lowerCAmelCase__					,      **lowerCAmelCase__     )

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

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

        _UpperCamelCase  :Union[str, Any]       =classifier_dropout




class    lowerCamelCase__  (   __snake_case     ):



   @property
   def  _UpperCamelCase		(    self     )				->     Mapping[str, Mapping[int, str]]:
        """simple docstring"""





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




import json
import os
import tempfile

import datasets
from utils import generate_example_dataset, get_duration


__snake_case  : Dict		       =    500_000

__snake_case       ,       __snake_case  : List[str]		       =    os.path.split(__file__)
__snake_case  : Optional[Any]		       =    os.path.join(RESULTS_BASEPATH, 'results', RESULTS_FILENAME.replace('.py', '.json'))





@get_duration
def 	_UpperCAmelCase       (				_UpperCamelCase       :      datasets.Dataset  )      -> Union[str, Any]:
    A_      =  dataset.select(range(0,  len(_UpperCamelCase  ),  2  )  )





@get_duration
def 	_UpperCAmelCase       (				_UpperCamelCase       :      datasets.Dataset  )      -> str:
    A_      =  dataset.sort('''numbers'''  )





@get_duration
def 	_UpperCAmelCase       (				_UpperCamelCase       :      datasets.Dataset  )      -> str:
    A_      =  dataset.shuffle()





@get_duration
def 	_UpperCAmelCase       (				_UpperCamelCase       :      datasets.Dataset  )      -> Optional[Any]:
    A_      =  dataset.train_test_split(0.1  )





@get_duration
def 	_UpperCAmelCase       (				_UpperCamelCase       :      datasets.Dataset,  _UpperCamelCase       :      Optional[int]=10  )      -> Dict:
    for shard_id in range(_UpperCamelCase  ):
        A_      =  dataset.shard(_UpperCamelCase,  _UpperCamelCase  )





def 	_UpperCAmelCase       (				)      -> Any:
    A_      =  {'''num examples''': SPEED_TEST_N_EXAMPLES}
    A_      =  (select, sort, shuffle, train_test_split, shard)
    with tempfile.TemporaryDirectory() as tmp_dir:
        print('''generating dataset'''  )
        A_      =  datasets.Features({'''text''': datasets.Value('''string'''  ), '''numbers''': datasets.Value('''float32'''  )}  )
        A_      =  generate_example_dataset(
            os.path.join(_UpperCamelCase,  '''dataset.arrow'''  ),  _UpperCamelCase,  num_examples=_UpperCamelCase  )
        print('''Functions'''  )
        for func in functions:
            print(func.__name__  )
            A_      =  func(_UpperCamelCase  )

    with open(_UpperCamelCase,  '''wb'''  ) as f:
        f.write(json.dumps(_UpperCamelCase  ).encode('''utf-8'''  )  )


if __name__ == "__main__":  # useful to run the profiler
  benchmark_indices_mapping()






