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

Move info_utils errors to exceptions module #6952

Merged
merged 6 commits into from
Jun 10, 2024

Conversation

albertvillanova
Copy link
Member

@albertvillanova albertvillanova commented Jun 4, 2024

Move info_utils errors to exceptions module.

Additionally rename some of them, deprecate the former ones, and make the deprecation backward compatible (by making the new errors inherit from the former ones).

@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.

"""


class SplitsVerificationError(DatasetsError, SplitsVerificationException):
Copy link
Member

Choose a reason for hiding this comment

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

is it also marked as deprecated since it inherits from SplitsVerificationException ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have renamed SplitsVerificationException to SplitsVerificationError and deprecated the former. The new SplitsVerificationError is not deprecated.

It inherits from SplitsVerificationException for backward compatibility: if a user is catching SplitsVerificationException, now it will also catch SplitsVerificationError.

Copy link
Member

@lhoestq lhoestq Jun 5, 2024

Choose a reason for hiding this comment

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

yes but since you subclass from the deprecated class, the subclass is also marked as deprecated

In [1]: from datasets.exceptions import *

In [2]: ChecksumVerificationError()
<ipython-input-2-0953a165cf8e>:1: FutureWarning: ChecksumVerificationException is deprecated and will be removed in the next major version of datasets. Use 'ChecksumVerificationError' instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oups! Thanks for letting me know... 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

@lhoestq I fixed it.

Copy link
Member

@lhoestq lhoestq left a comment

Choose a reason for hiding this comment

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

nice !

@albertvillanova albertvillanova merged commit 37a6036 into main Jun 10, 2024
12 checks passed
@albertvillanova albertvillanova deleted the move-info-utils-errors branch June 10, 2024 14:03
Copy link

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.005232 / 0.011353 (-0.006121) 0.003744 / 0.011008 (-0.007264) 0.064089 / 0.038508 (0.025581) 0.032409 / 0.023109 (0.009300) 0.255886 / 0.275898 (-0.020013) 0.276033 / 0.323480 (-0.047447) 0.004165 / 0.007986 (-0.003821) 0.002741 / 0.004328 (-0.001588) 0.052145 / 0.004250 (0.047894) 0.043863 / 0.037052 (0.006811) 0.258844 / 0.258489 (0.000355) 0.290108 / 0.293841 (-0.003733) 0.027390 / 0.128546 (-0.101156) 0.010543 / 0.075646 (-0.065103) 0.206936 / 0.419271 (-0.212335) 0.036778 / 0.043533 (-0.006755) 0.254331 / 0.255139 (-0.000808) 0.279037 / 0.283200 (-0.004163) 0.018564 / 0.141683 (-0.123119) 1.112765 / 1.452155 (-0.339390) 1.160099 / 1.492716 (-0.332617)

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.092148 / 0.018006 (0.074142) 0.297156 / 0.000490 (0.296667) 0.000211 / 0.000200 (0.000011) 0.000043 / 0.000054 (-0.000011)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.018797 / 0.037411 (-0.018615) 0.062992 / 0.014526 (0.048466) 0.076361 / 0.176557 (-0.100195) 0.121168 / 0.737135 (-0.615968) 0.075845 / 0.296338 (-0.220494)

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.293842 / 0.215209 (0.078633) 2.880720 / 2.077655 (0.803065) 1.477779 / 1.504120 (-0.026341) 1.345136 / 1.541195 (-0.196059) 1.352153 / 1.468490 (-0.116337) 0.574722 / 4.584777 (-4.010055) 2.373925 / 3.745712 (-1.371787) 2.750704 / 5.269862 (-2.519157) 1.725979 / 4.565676 (-2.839697) 0.063006 / 0.424275 (-0.361269) 0.005019 / 0.007607 (-0.002588) 0.341228 / 0.226044 (0.115184) 3.352576 / 2.268929 (1.083647) 1.821363 / 55.444624 (-53.623261) 1.529441 / 6.876477 (-5.347036) 1.543401 / 2.142072 (-0.598671) 0.634282 / 4.805227 (-4.170945) 0.115565 / 6.500664 (-6.385099) 0.042514 / 0.075469 (-0.032956)

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) 0.987532 / 1.841788 (-0.854255) 11.483853 / 8.074308 (3.409545) 9.565657 / 10.191392 (-0.625735) 0.141247 / 0.680424 (-0.539176) 0.015026 / 0.534201 (-0.519175) 0.299905 / 0.579283 (-0.279378) 0.267667 / 0.434364 (-0.166697) 0.320661 / 0.540337 (-0.219676) 0.427368 / 1.386936 (-0.959568)
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.005448 / 0.011353 (-0.005905) 0.003726 / 0.011008 (-0.007283) 0.049776 / 0.038508 (0.011268) 0.032733 / 0.023109 (0.009624) 0.261387 / 0.275898 (-0.014511) 0.280087 / 0.323480 (-0.043393) 0.004351 / 0.007986 (-0.003634) 0.002842 / 0.004328 (-0.001487) 0.049440 / 0.004250 (0.045190) 0.039585 / 0.037052 (0.002533) 0.266331 / 0.258489 (0.007842) 0.299643 / 0.293841 (0.005802) 0.029649 / 0.128546 (-0.098897) 0.010381 / 0.075646 (-0.065265) 0.058596 / 0.419271 (-0.360676) 0.033271 / 0.043533 (-0.010262) 0.251070 / 0.255139 (-0.004069) 0.272850 / 0.283200 (-0.010349) 0.016728 / 0.141683 (-0.124955) 1.146952 / 1.452155 (-0.305202) 1.182602 / 1.492716 (-0.310114)

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.091673 / 0.018006 (0.073667) 0.297228 / 0.000490 (0.296738) 0.000197 / 0.000200 (-0.000003) 0.000051 / 0.000054 (-0.000003)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.023174 / 0.037411 (-0.014237) 0.078866 / 0.014526 (0.064341) 0.088436 / 0.176557 (-0.088121) 0.129650 / 0.737135 (-0.607485) 0.091100 / 0.296338 (-0.205238)

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.293882 / 0.215209 (0.078673) 2.882667 / 2.077655 (0.805012) 1.562949 / 1.504120 (0.058829) 1.435104 / 1.541195 (-0.106090) 1.450815 / 1.468490 (-0.017675) 0.584090 / 4.584777 (-4.000687) 0.984176 / 3.745712 (-2.761536) 2.668740 / 5.269862 (-2.601121) 1.766993 / 4.565676 (-2.798683) 0.064710 / 0.424275 (-0.359565) 0.005329 / 0.007607 (-0.002278) 0.346008 / 0.226044 (0.119964) 3.414576 / 2.268929 (1.145647) 1.911388 / 55.444624 (-53.533236) 1.660357 / 6.876477 (-5.216120) 1.818628 / 2.142072 (-0.323444) 0.659585 / 4.805227 (-4.145643) 0.116980 / 6.500664 (-6.383684) 0.041364 / 0.075469 (-0.034105)

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.005659 / 1.841788 (-0.836129) 12.023761 / 8.074308 (3.949453) 10.351086 / 10.191392 (0.159694) 0.143261 / 0.680424 (-0.537162) 0.016143 / 0.534201 (-0.518058) 0.287793 / 0.579283 (-0.291490) 0.123698 / 0.434364 (-0.310666) 0.325241 / 0.540337 (-0.215097) 0.418772 / 1.386936 (-0.968164)

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.

3 participants