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

Fix missing info when loading some datasets from Parquet export #6635

Merged
merged 5 commits into from
Feb 7, 2024

Conversation

lhoestq
Copy link
Member

@lhoestq lhoestq commented Jan 31, 2024

Fix getting the info for script-based datasets with Parquet export with a single config not named "default".

E.g.

from datasets import load_dataset_builder

b = load_dataset_builder("bookcorpus")
print(b.info.features)
# should print {'text': Value(dtype='string', id=None)}

I fixed this by setting the default config name when there is only one config.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@lhoestq lhoestq marked this pull request as ready for review February 6, 2024 16:50
Copy link
Member

@albertvillanova albertvillanova left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! Cool.

Just a nit formal comment below, but feel free to ignore it.

src/datasets/utils/metadata.py Outdated Show resolved Hide resolved
Co-authored-by: Albert Villanova del Moral <8515462+albertvillanova@users.noreply.github.com>
@lhoestq lhoestq merged commit 14d9afb into main Feb 7, 2024
12 checks passed
@lhoestq lhoestq deleted the fix-info-from-single-config-parquet-export branch February 7, 2024 16:41
Copy link

github-actions bot commented Feb 7, 2024

Show benchmarks

PyArrow==8.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.005577 / 0.011353 (-0.005776) 0.004452 / 0.011008 (-0.006556) 0.067849 / 0.038508 (0.029341) 0.032328 / 0.023109 (0.009219) 0.256924 / 0.275898 (-0.018974) 0.273410 / 0.323480 (-0.050070) 0.004359 / 0.007986 (-0.003626) 0.003484 / 0.004328 (-0.000845) 0.053880 / 0.004250 (0.049630) 0.058142 / 0.037052 (0.021089) 0.268863 / 0.258489 (0.010374) 0.307977 / 0.293841 (0.014136) 0.028840 / 0.128546 (-0.099707) 0.011808 / 0.075646 (-0.063839) 0.216277 / 0.419271 (-0.202995) 0.039245 / 0.043533 (-0.004288) 0.250420 / 0.255139 (-0.004719) 0.273642 / 0.283200 (-0.009557) 0.019340 / 0.141683 (-0.122342) 1.176734 / 1.452155 (-0.275421) 1.250643 / 1.492716 (-0.242074)

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.181210 / 0.018006 (0.163204) 1.070750 / 0.000490 (1.070261) 0.000315 / 0.000200 (0.000115) 0.000045 / 0.000054 (-0.000009)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.022905 / 0.037411 (-0.014507) 0.064549 / 0.014526 (0.050023) 0.077113 / 0.176557 (-0.099443) 0.131976 / 0.737135 (-0.605159) 0.081266 / 0.296338 (-0.215072)

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.291363 / 0.215209 (0.076154) 2.851691 / 2.077655 (0.774036) 1.592815 / 1.504120 (0.088695) 1.494550 / 1.541195 (-0.046645) 1.516464 / 1.468490 (0.047974) 0.583244 / 4.584777 (-4.001532) 2.504907 / 3.745712 (-1.240805) 3.183490 / 5.269862 (-2.086371) 1.932854 / 4.565676 (-2.632823) 0.067564 / 0.424275 (-0.356711) 0.006587 / 0.007607 (-0.001020) 0.346368 / 0.226044 (0.120324) 3.428256 / 2.268929 (1.159327) 1.994176 / 55.444624 (-53.450448) 1.688116 / 6.876477 (-5.188360) 1.767653 / 2.142072 (-0.374420) 0.673867 / 4.805227 (-4.131360) 0.125582 / 6.500664 (-6.375082) 0.047198 / 0.075469 (-0.028271)

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.002895 / 1.841788 (-0.838893) 16.332893 / 8.074308 (8.258585) 10.781993 / 10.191392 (0.590601) 0.153919 / 0.680424 (-0.526505) 0.015528 / 0.534201 (-0.518673) 0.306182 / 0.579283 (-0.273101) 0.296380 / 0.434364 (-0.137984) 0.341432 / 0.540337 (-0.198905) 0.455900 / 1.386936 (-0.931036)
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.006442 / 0.011353 (-0.004911) 0.004433 / 0.011008 (-0.006576) 0.053327 / 0.038508 (0.014819) 0.035966 / 0.023109 (0.012856) 0.280913 / 0.275898 (0.005015) 0.308419 / 0.323480 (-0.015061) 0.005842 / 0.007986 (-0.002144) 0.003789 / 0.004328 (-0.000539) 0.053983 / 0.004250 (0.049732) 0.069052 / 0.037052 (0.032000) 0.299225 / 0.258489 (0.040736) 0.336470 / 0.293841 (0.042629) 0.068170 / 0.128546 (-0.060377) 0.012259 / 0.075646 (-0.063388) 0.064166 / 0.419271 (-0.355106) 0.037291 / 0.043533 (-0.006241) 0.281318 / 0.255139 (0.026179) 0.297093 / 0.283200 (0.013893) 0.021358 / 0.141683 (-0.120324) 1.189584 / 1.452155 (-0.262571) 1.256985 / 1.492716 (-0.235731)

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.216726 / 0.018006 (0.198720) 2.496957 / 0.000490 (2.496467) 0.000336 / 0.000200 (0.000136) 0.000070 / 0.000054 (0.000016)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.026604 / 0.037411 (-0.010807) 0.080398 / 0.014526 (0.065873) 0.094475 / 0.176557 (-0.082082) 0.136263 / 0.737135 (-0.600873) 0.097898 / 0.296338 (-0.198440)

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.295171 / 0.215209 (0.079962) 2.947530 / 2.077655 (0.869875) 1.607531 / 1.504120 (0.103411) 1.485045 / 1.541195 (-0.056150) 1.524899 / 1.468490 (0.056409) 0.572934 / 4.584777 (-4.011843) 2.544320 / 3.745712 (-1.201393) 3.292630 / 5.269862 (-1.977232) 1.927138 / 4.565676 (-2.638539) 0.068560 / 0.424275 (-0.355715) 0.005982 / 0.007607 (-0.001625) 0.345833 / 0.226044 (0.119789) 3.424253 / 2.268929 (1.155324) 2.195017 / 55.444624 (-53.249608) 1.712037 / 6.876477 (-5.164440) 1.763899 / 2.142072 (-0.378174) 0.653776 / 4.805227 (-4.151451) 0.123056 / 6.500664 (-6.377609) 0.044572 / 0.075469 (-0.030897)

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.033400 / 1.841788 (-0.808388) 15.409887 / 8.074308 (7.335579) 11.220990 / 10.191392 (1.029597) 0.153603 / 0.680424 (-0.526821) 0.016866 / 0.534201 (-0.517335) 0.311945 / 0.579283 (-0.267338) 0.307048 / 0.434364 (-0.127316) 0.350422 / 0.540337 (-0.189915) 0.447308 / 1.386936 (-0.939628)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants