




'''simple docstring'''





import json
import os
import tempfile

import datasets
from utils import generate_example_dataset, get_duration


a		:	Optional[int]       =      5_0_0_0_0_0

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





@get_duration
def UpperCAmelCase    (       UpperCAmelCase_						):
    _a				:							Optional[Any]							       =      dataset.select(range(0   ,	len(lowercase__						)   ,	2						)						)





@get_duration
def UpperCAmelCase    (       UpperCAmelCase_						):
    _a				:							List[Any]							       =      dataset.sort("""numbers"""						)





@get_duration
def UpperCAmelCase    (       UpperCAmelCase_						):
    _a				:							Optional[int]							       =      dataset.shuffle()





@get_duration
def UpperCAmelCase    (       UpperCAmelCase_						):
    _a				:							Optional[Any]							       =      dataset.train_test_split(0.1						)





@get_duration
def UpperCAmelCase    (       UpperCAmelCase_   ,	UpperCAmelCase_=10						):






    for shard_id in range(lowercase__						):
        _a				:							Optional[int]							       =      dataset.shard(lowercase__   ,	lowercase__						)





def UpperCAmelCase    (       ):
    _a				:							List[str]							       =      {"""num examples""": SPEED_TEST_N_EXAMPLES}
    _a				:							Optional[int]							       =      (select, sort, shuffle, train_test_split, shard)
    with tempfile.TemporaryDirectory() as tmp_dir:
        print("""generating dataset"""						)
        _a				:							int							       =      datasets.Features({"""text""": datasets.Value("""string"""						), """numbers""": datasets.Value("""float32"""						)}						)
        _a				:							Optional[int]							       =      generate_example_dataset(
            os.path.join(lowercase__   ,	"""dataset.arrow"""						)   ,	lowercase__   ,	num_examples=lowercase__						)
        print("""Functions"""						)
        for func in functions:
            print(func.__name__						)
            _a				:							int							       =      func(lowercase__						)

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


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






__SCREAMING_SNAKE_CASE	:							Optional[Any]           =  '''
# Transformers installation
! pip install transformers datasets
# To install from source instead of the last release, comment the command above and uncomment the following one.
# ! pip install git+https://github.com/huggingface/transformers.git
'''

__SCREAMING_SNAKE_CASE	:							Optional[int]           =  [{'''type''': '''code''', '''content''': INSTALL_CONTENT}]
__SCREAMING_SNAKE_CASE	:							Optional[int]           =  {
    '''{processor_class}''': '''FakeProcessorClass''',
    '''{model_class}''': '''FakeModelClass''',
    '''{object_class}''': '''FakeObjectClass''',
}

