Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align IterableDataset.shuffle with Dataset.shuffle #3842

Merged
merged 7 commits into from Mar 7, 2022

Conversation

lhoestq
Copy link
Member

@lhoestq lhoestq commented Mar 7, 2022

From #3444 , Dataset.shuffle can have the same API than IterableDataset.shuffle (i.e. in streaming mode).

Currently you can pass an optional seed to both if you want, BUT currently IterableDataset.shuffle always requires a buffer_size, used for approximate shuffling. I propose using a reasonable default value (maybe 1000) instead.

In this PR, I set the default buffer_size value to 1,000, and I reorder the IterableDataset.shuffle arguments to match Dataset.shuffle, i.e. making seed the first argument.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

github-actions[bot]
Copy link

@github-actions github-actions bot commented on a08d297 Mar 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Show benchmarks

PyArrow==5.0.0

Show updated benchmarks!

Benchmark: benchmark_array_xd.json

metric read_batch_formatted_as_numpy after write_array2d read_batch_formatted_as_numpy after write_flattened_sequence read_batch_formatted_as_numpy after write_nested_sequence read_batch_unformated after write_array2d read_batch_unformated after write_flattened_sequence read_batch_unformated after write_nested_sequence read_col_formatted_as_numpy after write_array2d read_col_formatted_as_numpy after write_flattened_sequence read_col_formatted_as_numpy after write_nested_sequence read_col_unformated after write_array2d read_col_unformated after write_flattened_sequence read_col_unformated after write_nested_sequence read_formatted_as_numpy after write_array2d read_formatted_as_numpy after write_flattened_sequence read_formatted_as_numpy after write_nested_sequence read_unformated after write_array2d read_unformated after write_flattened_sequence read_unformated after write_nested_sequence write_array2d write_flattened_sequence write_nested_sequence
new / old (diff) 0.012965 / 0.011353 (0.001612) 0.005352 / 0.011008 (-0.005656) 0.040560 / 0.038508 (0.002052) 0.041557 / 0.023109 (0.018447) 0.430742 / 0.275898 (0.154844) 0.448584 / 0.323480 (0.125104) 0.010068 / 0.007986 (0.002082) 0.006289 / 0.004328 (0.001961) 0.011117 / 0.004250 (0.006867) 0.050103 / 0.037052 (0.013051) 0.396521 / 0.258489 (0.138032) 0.456045 / 0.293841 (0.162204) 0.051407 / 0.128546 (-0.077140) 0.016604 / 0.075646 (-0.059042) 0.337182 / 0.419271 (-0.082090) 0.068240 / 0.043533 (0.024707) 0.415029 / 0.255139 (0.159890) 0.450125 / 0.283200 (0.166925) 0.124136 / 0.141683 (-0.017547) 2.321381 / 1.452155 (0.869227) 2.406284 / 1.492716 (0.913567)

Benchmark: benchmark_getitem_100B.json

metric get_batch_of_1024_random_rows get_batch_of_1024_rows get_first_row get_last_row
new / old (diff) 0.409098 / 0.018006 (0.391092) 0.578291 / 0.000490 (0.577801) 0.084059 / 0.000200 (0.083859) 0.001029 / 0.000054 (0.000974)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.031134 / 0.037411 (-0.006277) 0.123579 / 0.014526 (0.109054) 0.136754 / 0.176557 (-0.039803) 0.188139 / 0.737135 (-0.548996) 0.132114 / 0.296338 (-0.164224)

Benchmark: benchmark_iterating.json

metric read 5000 read 50000 read_batch 50000 10 read_batch 50000 100 read_batch 50000 1000 read_formatted numpy 5000 read_formatted pandas 5000 read_formatted tensorflow 5000 read_formatted torch 5000 read_formatted_batch numpy 5000 10 read_formatted_batch numpy 5000 1000 shuffled read 5000 shuffled read 50000 shuffled read_batch 50000 10 shuffled read_batch 50000 100 shuffled read_batch 50000 1000 shuffled read_formatted numpy 5000 shuffled read_formatted_batch numpy 5000 10 shuffled read_formatted_batch numpy 5000 1000
new / old (diff) 0.659482 / 0.215209 (0.444273) 6.589733 / 2.077655 (4.512078) 2.584376 / 1.504120 (1.080256) 2.200007 / 1.541195 (0.658812) 2.255129 / 1.468490 (0.786639) 0.795846 / 4.584777 (-3.788931) 7.015840 / 3.745712 (3.270128) 5.680581 / 5.269862 (0.410720) 1.593514 / 4.565676 (-2.972163) 0.098538 / 0.424275 (-0.325737) 0.016043 / 0.007607 (0.008436) 0.789763 / 0.226044 (0.563718) 7.981322 / 2.268929 (5.712393) 3.251795 / 55.444624 (-52.192829) 2.567624 / 6.876477 (-4.308853) 2.701480 / 2.142072 (0.559407) 0.979560 / 4.805227 (-3.825667) 0.203651 / 6.500664 (-6.297013) 0.090623 / 0.075469 (0.015153)

Benchmark: benchmark_map_filter.json

metric filter map fast-tokenizer batched map identity map identity batched map no-op batched map no-op batched numpy map no-op batched pandas map no-op batched pytorch map no-op batched tensorflow
new / old (diff) 2.213709 / 1.841788 (0.371922) 17.477169 / 8.074308 (9.402861) 44.263857 / 10.191392 (34.072465) 1.202334 / 0.680424 (0.521910) 0.714806 / 0.534201 (0.180605) 0.674080 / 0.579283 (0.094797) 0.736728 / 0.434364 (0.302364) 0.437601 / 0.540337 (-0.102736) 0.424189 / 1.386936 (-0.962747)
PyArrow==latest
Show updated benchmarks!

Benchmark: benchmark_array_xd.json

metric read_batch_formatted_as_numpy after write_array2d read_batch_formatted_as_numpy after write_flattened_sequence read_batch_formatted_as_numpy after write_nested_sequence read_batch_unformated after write_array2d read_batch_unformated after write_flattened_sequence read_batch_unformated after write_nested_sequence read_col_formatted_as_numpy after write_array2d read_col_formatted_as_numpy after write_flattened_sequence read_col_formatted_as_numpy after write_nested_sequence read_col_unformated after write_array2d read_col_unformated after write_flattened_sequence read_col_unformated after write_nested_sequence read_formatted_as_numpy after write_array2d read_formatted_as_numpy after write_flattened_sequence read_formatted_as_numpy after write_nested_sequence read_unformated after write_array2d read_unformated after write_flattened_sequence read_unformated after write_nested_sequence write_array2d write_flattened_sequence write_nested_sequence
new / old (diff) 0.012127 / 0.011353 (0.000774) 0.005317 / 0.011008 (-0.005691) 0.038180 / 0.038508 (-0.000328) 0.039328 / 0.023109 (0.016219) 0.425532 / 0.275898 (0.149634) 0.441620 / 0.323480 (0.118140) 0.007808 / 0.007986 (-0.000178) 0.006105 / 0.004328 (0.001776) 0.009135 / 0.004250 (0.004885) 0.044313 / 0.037052 (0.007260) 0.403288 / 0.258489 (0.144799) 0.433111 / 0.293841 (0.139270) 0.057655 / 0.128546 (-0.070891) 0.015975 / 0.075646 (-0.059671) 0.339130 / 0.419271 (-0.080142) 0.069347 / 0.043533 (0.025814) 0.400377 / 0.255139 (0.145238) 0.443655 / 0.283200 (0.160455) 0.122480 / 0.141683 (-0.019203) 2.230519 / 1.452155 (0.778364) 2.327355 / 1.492716 (0.834639)

Benchmark: benchmark_getitem_100B.json

metric get_batch_of_1024_random_rows get_batch_of_1024_rows get_first_row get_last_row
new / old (diff) 0.336052 / 0.018006 (0.318046) 0.574188 / 0.000490 (0.573699) 0.013633 / 0.000200 (0.013433) 0.000130 / 0.000054 (0.000075)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.029187 / 0.037411 (-0.008225) 0.115841 / 0.014526 (0.101315) 0.131215 / 0.176557 (-0.045341) 0.185315 / 0.737135 (-0.551820) 0.134101 / 0.296338 (-0.162237)

Benchmark: benchmark_iterating.json

metric read 5000 read 50000 read_batch 50000 10 read_batch 50000 100 read_batch 50000 1000 read_formatted numpy 5000 read_formatted pandas 5000 read_formatted tensorflow 5000 read_formatted torch 5000 read_formatted_batch numpy 5000 10 read_formatted_batch numpy 5000 1000 shuffled read 5000 shuffled read 50000 shuffled read_batch 50000 10 shuffled read_batch 50000 100 shuffled read_batch 50000 1000 shuffled read_formatted numpy 5000 shuffled read_formatted_batch numpy 5000 10 shuffled read_formatted_batch numpy 5000 1000
new / old (diff) 0.669136 / 0.215209 (0.453926) 6.607545 / 2.077655 (4.529890) 2.638676 / 1.504120 (1.134556) 2.231961 / 1.541195 (0.690766) 2.294386 / 1.468490 (0.825895) 0.803527 / 4.584777 (-3.781250) 7.162752 / 3.745712 (3.417040) 3.238122 / 5.269862 (-2.031740) 1.627716 / 4.565676 (-2.937960) 0.090104 / 0.424275 (-0.334172) 0.015733 / 0.007607 (0.008126) 0.791386 / 0.226044 (0.565342) 8.110715 / 2.268929 (5.841786) 3.327518 / 55.444624 (-52.117107) 2.562115 / 6.876477 (-4.314362) 2.688602 / 2.142072 (0.546530) 1.007168 / 4.805227 (-3.798060) 0.206118 / 6.500664 (-6.294546) 0.081374 / 0.075469 (0.005904)

Benchmark: benchmark_map_filter.json

metric filter map fast-tokenizer batched map identity map identity batched map no-op batched map no-op batched numpy map no-op batched pandas map no-op batched pytorch map no-op batched tensorflow
new / old (diff) 2.154769 / 1.841788 (0.312981) 17.419492 / 8.074308 (9.345184) 46.857985 / 10.191392 (36.666593) 1.197379 / 0.680424 (0.516955) 0.707306 / 0.534201 (0.173105) 0.651364 / 0.579283 (0.072081) 0.749328 / 0.434364 (0.314964) 0.440661 / 0.540337 (-0.099676) 0.461505 / 1.386936 (-0.925431)

CML watermark

@mariosasko
Copy link
Contributor

@mariosasko mariosasko commented Mar 7, 2022

We should also add generator as a param to shuffle to fully align the APIs, no?

@lhoestq
Copy link
Member Author

@lhoestq lhoestq commented Mar 7, 2022

I added the generator argument.

I had to make a few other adjustments to make it work. In particular when you call set_epoch() on a streaming dataset, it updates the underlying random generator by using a new effective seed. The effective seed is generated using the previous generator and the epoch number.

github-actions[bot]
Copy link

@github-actions github-actions bot commented on 60833d0 Mar 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Show benchmarks

PyArrow==5.0.0

Show updated benchmarks!

Benchmark: benchmark_array_xd.json

metric read_batch_formatted_as_numpy after write_array2d read_batch_formatted_as_numpy after write_flattened_sequence read_batch_formatted_as_numpy after write_nested_sequence read_batch_unformated after write_array2d read_batch_unformated after write_flattened_sequence read_batch_unformated after write_nested_sequence read_col_formatted_as_numpy after write_array2d read_col_formatted_as_numpy after write_flattened_sequence read_col_formatted_as_numpy after write_nested_sequence read_col_unformated after write_array2d read_col_unformated after write_flattened_sequence read_col_unformated after write_nested_sequence read_formatted_as_numpy after write_array2d read_formatted_as_numpy after write_flattened_sequence read_formatted_as_numpy after write_nested_sequence read_unformated after write_array2d read_unformated after write_flattened_sequence read_unformated after write_nested_sequence write_array2d write_flattened_sequence write_nested_sequence
new / old (diff) 0.010265 / 0.011353 (-0.001088) 0.004141 / 0.011008 (-0.006867) 0.031597 / 0.038508 (-0.006911) 0.037220 / 0.023109 (0.014111) 0.302887 / 0.275898 (0.026989) 0.325899 / 0.323480 (0.002419) 0.008162 / 0.007986 (0.000176) 0.005667 / 0.004328 (0.001338) 0.009157 / 0.004250 (0.004907) 0.043887 / 0.037052 (0.006835) 0.280383 / 0.258489 (0.021894) 0.327924 / 0.293841 (0.034083) 0.032374 / 0.128546 (-0.096173) 0.009787 / 0.075646 (-0.065859) 0.254630 / 0.419271 (-0.164641) 0.051681 / 0.043533 (0.008149) 0.287789 / 0.255139 (0.032650) 0.316116 / 0.283200 (0.032917) 0.109169 / 0.141683 (-0.032514) 1.807709 / 1.452155 (0.355554) 1.866692 / 1.492716 (0.373975)

Benchmark: benchmark_getitem_100B.json

metric get_batch_of_1024_random_rows get_batch_of_1024_rows get_first_row get_last_row
new / old (diff) 0.277803 / 0.018006 (0.259796) 0.432958 / 0.000490 (0.432468) 0.015295 / 0.000200 (0.015095) 0.000480 / 0.000054 (0.000425)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.025071 / 0.037411 (-0.012340) 0.090819 / 0.014526 (0.076293) 0.101912 / 0.176557 (-0.074645) 0.146956 / 0.737135 (-0.590180) 0.102223 / 0.296338 (-0.194116)

Benchmark: benchmark_iterating.json

metric read 5000 read 50000 read_batch 50000 10 read_batch 50000 100 read_batch 50000 1000 read_formatted numpy 5000 read_formatted pandas 5000 read_formatted tensorflow 5000 read_formatted torch 5000 read_formatted_batch numpy 5000 10 read_formatted_batch numpy 5000 1000 shuffled read 5000 shuffled read 50000 shuffled read_batch 50000 10 shuffled read_batch 50000 100 shuffled read_batch 50000 1000 shuffled read_formatted numpy 5000 shuffled read_formatted_batch numpy 5000 10 shuffled read_formatted_batch numpy 5000 1000
new / old (diff) 0.366226 / 0.215209 (0.151017) 3.648649 / 2.077655 (1.570994) 1.548299 / 1.504120 (0.044179) 1.370250 / 1.541195 (-0.170945) 1.462861 / 1.468490 (-0.005629) 0.386641 / 4.584777 (-4.198136) 4.588808 / 3.745712 (0.843096) 3.458539 / 5.269862 (-1.811323) 0.940367 / 4.565676 (-3.625309) 0.053324 / 0.424275 (-0.370951) 0.012250 / 0.007607 (0.004643) 0.515378 / 0.226044 (0.289333) 5.182958 / 2.268929 (2.914029) 2.210160 / 55.444624 (-53.234465) 1.857176 / 6.876477 (-5.019300) 1.982607 / 2.142072 (-0.159465) 0.554378 / 4.805227 (-4.250849) 0.124401 / 6.500664 (-6.376263) 0.064067 / 0.075469 (-0.011403)

Benchmark: benchmark_map_filter.json

metric filter map fast-tokenizer batched map identity map identity batched map no-op batched map no-op batched numpy map no-op batched pandas map no-op batched pytorch map no-op batched tensorflow
new / old (diff) 1.462845 / 1.841788 (-0.378943) 13.396098 / 8.074308 (5.321790) 26.645238 / 10.191392 (16.453846) 0.878539 / 0.680424 (0.198115) 0.517030 / 0.534201 (-0.017171) 0.492763 / 0.579283 (-0.086520) 0.500471 / 0.434364 (0.066107) 0.316338 / 0.540337 (-0.223999) 0.294349 / 1.386936 (-1.092587)
PyArrow==latest
Show updated benchmarks!

Benchmark: benchmark_array_xd.json

metric read_batch_formatted_as_numpy after write_array2d read_batch_formatted_as_numpy after write_flattened_sequence read_batch_formatted_as_numpy after write_nested_sequence read_batch_unformated after write_array2d read_batch_unformated after write_flattened_sequence read_batch_unformated after write_nested_sequence read_col_formatted_as_numpy after write_array2d read_col_formatted_as_numpy after write_flattened_sequence read_col_formatted_as_numpy after write_nested_sequence read_col_unformated after write_array2d read_col_unformated after write_flattened_sequence read_col_unformated after write_nested_sequence read_formatted_as_numpy after write_array2d read_formatted_as_numpy after write_flattened_sequence read_formatted_as_numpy after write_nested_sequence read_unformated after write_array2d read_unformated after write_flattened_sequence read_unformated after write_nested_sequence write_array2d write_flattened_sequence write_nested_sequence
new / old (diff) 0.007746 / 0.011353 (-0.003607) 0.003654 / 0.011008 (-0.007354) 0.026245 / 0.038508 (-0.012263) 0.031183 / 0.023109 (0.008073) 0.291856 / 0.275898 (0.015958) 0.314125 / 0.323480 (-0.009355) 0.005757 / 0.007986 (-0.002229) 0.003192 / 0.004328 (-0.001137) 0.006536 / 0.004250 (0.002285) 0.036947 / 0.037052 (-0.000106) 0.285886 / 0.258489 (0.027397) 0.311047 / 0.293841 (0.017206) 0.028620 / 0.128546 (-0.099926) 0.008552 / 0.075646 (-0.067094) 0.224143 / 0.419271 (-0.195128) 0.045890 / 0.043533 (0.002358) 0.288421 / 0.255139 (0.033282) 0.305018 / 0.283200 (0.021818) 0.084726 / 0.141683 (-0.056957) 1.572084 / 1.452155 (0.119929) 1.608212 / 1.492716 (0.115495)

Benchmark: benchmark_getitem_100B.json

metric get_batch_of_1024_random_rows get_batch_of_1024_rows get_first_row get_last_row
new / old (diff) 0.282559 / 0.018006 (0.264553) 0.430398 / 0.000490 (0.429909) 0.039153 / 0.000200 (0.038953) 0.000460 / 0.000054 (0.000406)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.022407 / 0.037411 (-0.015005) 0.096179 / 0.014526 (0.081653) 0.104184 / 0.176557 (-0.072372) 0.167467 / 0.737135 (-0.569668) 0.104113 / 0.296338 (-0.192226)

Benchmark: benchmark_iterating.json

metric read 5000 read 50000 read_batch 50000 10 read_batch 50000 100 read_batch 50000 1000 read_formatted numpy 5000 read_formatted pandas 5000 read_formatted tensorflow 5000 read_formatted torch 5000 read_formatted_batch numpy 5000 10 read_formatted_batch numpy 5000 1000 shuffled read 5000 shuffled read 50000 shuffled read_batch 50000 10 shuffled read_batch 50000 100 shuffled read_batch 50000 1000 shuffled read_formatted numpy 5000 shuffled read_formatted_batch numpy 5000 10 shuffled read_formatted_batch numpy 5000 1000
new / old (diff) 0.371591 / 0.215209 (0.156382) 3.698602 / 2.077655 (1.620947) 1.589335 / 1.504120 (0.085215) 1.402348 / 1.541195 (-0.138847) 1.489831 / 1.468490 (0.021341) 0.391864 / 4.584777 (-4.192913) 4.534733 / 3.745712 (0.789020) 2.068578 / 5.269862 (-3.201284) 0.926555 / 4.565676 (-3.639122) 0.048645 / 0.424275 (-0.375630) 0.011520 / 0.007607 (0.003913) 0.469173 / 0.226044 (0.243129) 4.695068 / 2.268929 (2.426140) 2.038664 / 55.444624 (-53.405960) 1.724934 / 6.876477 (-5.151543) 1.847085 / 2.142072 (-0.294987) 0.497201 / 4.805227 (-4.308026) 0.110340 / 6.500664 (-6.390325) 0.055023 / 0.075469 (-0.020446)

Benchmark: benchmark_map_filter.json

metric filter map fast-tokenizer batched map identity map identity batched map no-op batched map no-op batched numpy map no-op batched pandas map no-op batched pytorch map no-op batched tensorflow
new / old (diff) 1.436824 / 1.841788 (-0.404964) 13.220354 / 8.074308 (5.146046) 23.824897 / 10.191392 (13.633505) 0.769603 / 0.680424 (0.089179) 0.472666 / 0.534201 (-0.061535) 0.441142 / 0.579283 (-0.138141) 0.485786 / 0.434364 (0.051422) 0.286899 / 0.540337 (-0.253439) 0.294280 / 1.386936 (-1.092656)

CML watermark

Copy link
Contributor

@mariosasko mariosasko left a comment

Thanks! One comment:

src/datasets/iterable_dataset.py Show resolved Hide resolved
lhoestq and others added 3 commits Mar 7, 2022
Co-authored-by: Mario Šaško <mariosasko777@gmail.com>
github-actions[bot]
Copy link

@github-actions github-actions bot commented on 63a78b8 Mar 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Show benchmarks

PyArrow==5.0.0

Show updated benchmarks!

Benchmark: benchmark_array_xd.json

metric read_batch_formatted_as_numpy after write_array2d read_batch_formatted_as_numpy after write_flattened_sequence read_batch_formatted_as_numpy after write_nested_sequence read_batch_unformated after write_array2d read_batch_unformated after write_flattened_sequence read_batch_unformated after write_nested_sequence read_col_formatted_as_numpy after write_array2d read_col_formatted_as_numpy after write_flattened_sequence read_col_formatted_as_numpy after write_nested_sequence read_col_unformated after write_array2d read_col_unformated after write_flattened_sequence read_col_unformated after write_nested_sequence read_formatted_as_numpy after write_array2d read_formatted_as_numpy after write_flattened_sequence read_formatted_as_numpy after write_nested_sequence read_unformated after write_array2d read_unformated after write_flattened_sequence read_unformated after write_nested_sequence write_array2d write_flattened_sequence write_nested_sequence
new / old (diff) 0.011925 / 0.011353 (0.000572) 0.004662 / 0.011008 (-0.006347) 0.037440 / 0.038508 (-0.001068) 0.047723 / 0.023109 (0.024613) 0.352955 / 0.275898 (0.077057) 0.381983 / 0.323480 (0.058503) 0.009526 / 0.007986 (0.001541) 0.005592 / 0.004328 (0.001263) 0.010705 / 0.004250 (0.006455) 0.047383 / 0.037052 (0.010331) 0.337302 / 0.258489 (0.078813) 0.386934 / 0.293841 (0.093093) 0.038485 / 0.128546 (-0.090062) 0.011139 / 0.075646 (-0.064507) 0.304052 / 0.419271 (-0.115219) 0.068086 / 0.043533 (0.024553) 0.346302 / 0.255139 (0.091163) 0.379037 / 0.283200 (0.095837) 0.126503 / 0.141683 (-0.015179) 2.098631 / 1.452155 (0.646476) 2.155793 / 1.492716 (0.663077)

Benchmark: benchmark_getitem_100B.json

metric get_batch_of_1024_random_rows get_batch_of_1024_rows get_first_row get_last_row
new / old (diff) 0.268916 / 0.018006 (0.250910) 0.489710 / 0.000490 (0.489220) 0.003308 / 0.000200 (0.003108) 0.000094 / 0.000054 (0.000040)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.030229 / 0.037411 (-0.007183) 0.124897 / 0.014526 (0.110372) 0.133407 / 0.176557 (-0.043150) 0.176541 / 0.737135 (-0.560595) 0.134549 / 0.296338 (-0.161790)

Benchmark: benchmark_iterating.json

metric read 5000 read 50000 read_batch 50000 10 read_batch 50000 100 read_batch 50000 1000 read_formatted numpy 5000 read_formatted pandas 5000 read_formatted tensorflow 5000 read_formatted torch 5000 read_formatted_batch numpy 5000 10 read_formatted_batch numpy 5000 1000 shuffled read 5000 shuffled read 50000 shuffled read_batch 50000 10 shuffled read_batch 50000 100 shuffled read_batch 50000 1000 shuffled read_formatted numpy 5000 shuffled read_formatted_batch numpy 5000 10 shuffled read_formatted_batch numpy 5000 1000
new / old (diff) 0.492628 / 0.215209 (0.277419) 4.877873 / 2.077655 (2.800218) 2.225100 / 1.504120 (0.720980) 2.021680 / 1.541195 (0.480486) 2.113728 / 1.468490 (0.645238) 0.510060 / 4.584777 (-4.074717) 5.527021 / 3.745712 (1.781309) 4.133677 / 5.269862 (-1.136185) 1.068608 / 4.565676 (-3.497069) 0.061986 / 0.424275 (-0.362289) 0.014371 / 0.007607 (0.006764) 0.621149 / 0.226044 (0.395105) 6.136340 / 2.268929 (3.867411) 2.715276 / 55.444624 (-52.729348) 2.292763 / 6.876477 (-4.583713) 2.404217 / 2.142072 (0.262145) 0.643025 / 4.805227 (-4.162202) 0.144495 / 6.500664 (-6.356169) 0.074524 / 0.075469 (-0.000946)

Benchmark: benchmark_map_filter.json

metric filter map fast-tokenizer batched map identity map identity batched map no-op batched map no-op batched numpy map no-op batched pandas map no-op batched pytorch map no-op batched tensorflow
new / old (diff) 2.033804 / 1.841788 (0.192016) 17.118592 / 8.074308 (9.044284) 31.087692 / 10.191392 (20.896300) 1.020699 / 0.680424 (0.340275) 0.617817 / 0.534201 (0.083616) 0.607704 / 0.579283 (0.028421) 0.621162 / 0.434364 (0.186798) 0.389435 / 0.540337 (-0.150903) 0.400630 / 1.386936 (-0.986306)
PyArrow==latest
Show updated benchmarks!

Benchmark: benchmark_array_xd.json

metric read_batch_formatted_as_numpy after write_array2d read_batch_formatted_as_numpy after write_flattened_sequence read_batch_formatted_as_numpy after write_nested_sequence read_batch_unformated after write_array2d read_batch_unformated after write_flattened_sequence read_batch_unformated after write_nested_sequence read_col_formatted_as_numpy after write_array2d read_col_formatted_as_numpy after write_flattened_sequence read_col_formatted_as_numpy after write_nested_sequence read_col_unformated after write_array2d read_col_unformated after write_flattened_sequence read_col_unformated after write_nested_sequence read_formatted_as_numpy after write_array2d read_formatted_as_numpy after write_flattened_sequence read_formatted_as_numpy after write_nested_sequence read_unformated after write_array2d read_unformated after write_flattened_sequence read_unformated after write_nested_sequence write_array2d write_flattened_sequence write_nested_sequence
new / old (diff) 0.009512 / 0.011353 (-0.001841) 0.004506 / 0.011008 (-0.006503) 0.035002 / 0.038508 (-0.003506) 0.039244 / 0.023109 (0.016135) 0.396766 / 0.275898 (0.120868) 0.391228 / 0.323480 (0.067748) 0.007028 / 0.007986 (-0.000958) 0.003883 / 0.004328 (-0.000445) 0.008449 / 0.004250 (0.004199) 0.044063 / 0.037052 (0.007010) 0.375530 / 0.258489 (0.117041) 0.392752 / 0.293841 (0.098911) 0.036075 / 0.128546 (-0.092471) 0.010865 / 0.075646 (-0.064781) 0.300019 / 0.419271 (-0.119253) 0.058817 / 0.043533 (0.015284) 0.379380 / 0.255139 (0.124241) 0.385289 / 0.283200 (0.102089) 0.102858 / 0.141683 (-0.038825) 2.058399 / 1.452155 (0.606244) 2.145849 / 1.492716 (0.653133)

Benchmark: benchmark_getitem_100B.json

metric get_batch_of_1024_random_rows get_batch_of_1024_rows get_first_row get_last_row
new / old (diff) 0.263808 / 0.018006 (0.245802) 0.478470 / 0.000490 (0.477980) 0.002681 / 0.000200 (0.002481) 0.000098 / 0.000054 (0.000044)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.030354 / 0.037411 (-0.007057) 0.120929 / 0.014526 (0.106403) 0.134490 / 0.176557 (-0.042066) 0.183690 / 0.737135 (-0.553446) 0.136002 / 0.296338 (-0.160336)

Benchmark: benchmark_iterating.json

metric read 5000 read 50000 read_batch 50000 10 read_batch 50000 100 read_batch 50000 1000 read_formatted numpy 5000 read_formatted pandas 5000 read_formatted tensorflow 5000 read_formatted torch 5000 read_formatted_batch numpy 5000 10 read_formatted_batch numpy 5000 1000 shuffled read 5000 shuffled read 50000 shuffled read_batch 50000 10 shuffled read_batch 50000 100 shuffled read_batch 50000 1000 shuffled read_formatted numpy 5000 shuffled read_formatted_batch numpy 5000 10 shuffled read_formatted_batch numpy 5000 1000
new / old (diff) 0.507633 / 0.215209 (0.292423) 5.053369 / 2.077655 (2.975715) 2.313809 / 1.504120 (0.809689) 2.062693 / 1.541195 (0.521499) 2.164562 / 1.468490 (0.696072) 0.511519 / 4.584777 (-4.073258) 5.766813 / 3.745712 (2.021101) 2.534596 / 5.269862 (-2.735266) 1.083819 / 4.565676 (-3.481858) 0.062624 / 0.424275 (-0.361651) 0.014453 / 0.007607 (0.006846) 0.635587 / 0.226044 (0.409542) 6.393774 / 2.268929 (4.124845) 2.854313 / 55.444624 (-52.590311) 2.415319 / 6.876477 (-4.461158) 2.583004 / 2.142072 (0.440931) 0.653309 / 4.805227 (-4.151918) 0.142532 / 6.500664 (-6.358132) 0.070864 / 0.075469 (-0.004605)

Benchmark: benchmark_map_filter.json

metric filter map fast-tokenizer batched map identity map identity batched map no-op batched map no-op batched numpy map no-op batched pandas map no-op batched pytorch map no-op batched tensorflow
new / old (diff) 1.920466 / 1.841788 (0.078678) 16.514037 / 8.074308 (8.439728) 30.886859 / 10.191392 (20.695467) 1.051365 / 0.680424 (0.370941) 0.621817 / 0.534201 (0.087616) 0.586959 / 0.579283 (0.007676) 0.646926 / 0.434364 (0.212562) 0.393000 / 0.540337 (-0.147337) 0.404600 / 1.386936 (-0.982336)

CML watermark

@lhoestq lhoestq merged commit 2a5149b into master Mar 7, 2022
8 checks passed
@lhoestq lhoestq deleted the align-iterable-dataset-shuffle branch Mar 7, 2022
@lhoestq lhoestq mentioned this pull request Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants