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

Remove deprecated code #6996

Merged
merged 36 commits into from
Aug 21, 2024
Merged

Remove deprecated code #6996

merged 36 commits into from
Aug 21, 2024

Conversation

albertvillanova
Copy link
Member

@albertvillanova albertvillanova commented Jun 25, 2024

Remove deprecated code, as part of the 3.0 release.

First merge:

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

@albertvillanova albertvillanova added this to the 3.0 milestone Jun 27, 2024
from typing import TYPE_CHECKING, List, Optional, Union

import pyarrow as pa
import pyarrow.parquet as pq
from tqdm.contrib.concurrent import thread_map

from .download.download_config import DownloadConfig
Copy link
Member Author

@albertvillanova albertvillanova Jun 27, 2024

Choose a reason for hiding this comment

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

The removal of this code line makes apparent an underlying circular import that was introduced by:

https://github.com/huggingface/datasets/actions/runs/9694146568/job/26751140360?pr=6996

    import datasets
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/datasets/__init__.py:17: in <module>
    from .arrow_dataset import Dataset
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/datasets/arrow_dataset.py:76: in <module>
    from .arrow_reader import ArrowReader
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/datasets/arrow_reader.py:31: in <module>
    from .table import InMemoryTable, MemoryMappedTable, Table, concat_tables
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/datasets/table.py:13: in <module>
    from .utils.logging import get_logger
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/datasets/utils/__init__.py:17: in <module>
    from .info_utils import VerificationMode
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/datasets/utils/info_utils.py:8: in <module>
    from ..exceptions import (
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/datasets/exceptions.py:8: in <module>
    from .table import CastError
E   ImportError: cannot import name 'CastError' from partially initialized module 'datasets.table' (most likely due to a circular import) (/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/datasets/table.py)

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 reverted the removal of this unused import, so that the underlying circular import remain hidden.

I would propose addressing the underlying circular import in a subsequent specific PR.

@albertvillanova albertvillanova marked this pull request as ready for review June 27, 2024 13:29
@albertvillanova albertvillanova merged commit c3aaf21 into main Aug 21, 2024
15 checks passed
@albertvillanova albertvillanova deleted the rm-deprecated branch August 21, 2024 09:35
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.005296 / 0.011353 (-0.006057) 0.003991 / 0.011008 (-0.007017) 0.063892 / 0.038508 (0.025384) 0.031185 / 0.023109 (0.008076) 0.248300 / 0.275898 (-0.027598) 0.270326 / 0.323480 (-0.053154) 0.004343 / 0.007986 (-0.003643) 0.002735 / 0.004328 (-0.001594) 0.049751 / 0.004250 (0.045501) 0.045629 / 0.037052 (0.008577) 0.257584 / 0.258489 (-0.000905) 0.284697 / 0.293841 (-0.009144) 0.029403 / 0.128546 (-0.099143) 0.012155 / 0.075646 (-0.063491) 0.215241 / 0.419271 (-0.204031) 0.036258 / 0.043533 (-0.007275) 0.246878 / 0.255139 (-0.008261) 0.268728 / 0.283200 (-0.014472) 0.018113 / 0.141683 (-0.123570) 1.130733 / 1.452155 (-0.321422) 1.205148 / 1.492716 (-0.287568)

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.095196 / 0.018006 (0.077189) 0.300741 / 0.000490 (0.300252) 0.000220 / 0.000200 (0.000020) 0.000043 / 0.000054 (-0.000011)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.018319 / 0.037411 (-0.019093) 0.062766 / 0.014526 (0.048240) 0.074748 / 0.176557 (-0.101809) 0.122177 / 0.737135 (-0.614959) 0.076652 / 0.296338 (-0.219687)

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.284508 / 0.215209 (0.069299) 2.838298 / 2.077655 (0.760643) 1.480098 / 1.504120 (-0.024022) 1.362882 / 1.541195 (-0.178313) 1.389036 / 1.468490 (-0.079454) 0.747485 / 4.584777 (-3.837292) 2.385333 / 3.745712 (-1.360379) 2.924148 / 5.269862 (-2.345713) 1.869061 / 4.565676 (-2.696616) 0.079909 / 0.424275 (-0.344366) 0.005173 / 0.007607 (-0.002434) 0.345694 / 0.226044 (0.119650) 3.430648 / 2.268929 (1.161719) 1.837108 / 55.444624 (-53.607516) 1.528498 / 6.876477 (-5.347979) 1.567128 / 2.142072 (-0.574944) 0.804615 / 4.805227 (-4.000612) 0.135361 / 6.500664 (-6.365303) 0.042195 / 0.075469 (-0.033274)

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.986240 / 1.841788 (-0.855548) 11.428084 / 8.074308 (3.353776) 9.168227 / 10.191392 (-1.023165) 0.131917 / 0.680424 (-0.548507) 0.014324 / 0.534201 (-0.519877) 0.302188 / 0.579283 (-0.277095) 0.263790 / 0.434364 (-0.170574) 0.343799 / 0.540337 (-0.196539) 0.428518 / 1.386936 (-0.958418)
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.005734 / 0.011353 (-0.005618) 0.003914 / 0.011008 (-0.007094) 0.050105 / 0.038508 (0.011596) 0.031748 / 0.023109 (0.008639) 0.266392 / 0.275898 (-0.009506) 0.301221 / 0.323480 (-0.022259) 0.004408 / 0.007986 (-0.003578) 0.002811 / 0.004328 (-0.001517) 0.049103 / 0.004250 (0.044853) 0.041030 / 0.037052 (0.003978) 0.281003 / 0.258489 (0.022513) 0.318086 / 0.293841 (0.024245) 0.032695 / 0.128546 (-0.095852) 0.012239 / 0.075646 (-0.063408) 0.060387 / 0.419271 (-0.358885) 0.034179 / 0.043533 (-0.009354) 0.266020 / 0.255139 (0.010881) 0.288551 / 0.283200 (0.005351) 0.018778 / 0.141683 (-0.122905) 1.214959 / 1.452155 (-0.237196) 1.268269 / 1.492716 (-0.224447)

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.095449 / 0.018006 (0.077443) 0.305733 / 0.000490 (0.305243) 0.000216 / 0.000200 (0.000016) 0.000052 / 0.000054 (-0.000002)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.022565 / 0.037411 (-0.014847) 0.077266 / 0.014526 (0.062740) 0.089345 / 0.176557 (-0.087212) 0.128900 / 0.737135 (-0.608236) 0.089746 / 0.296338 (-0.206593)

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.298221 / 0.215209 (0.083012) 2.957671 / 2.077655 (0.880016) 1.584674 / 1.504120 (0.080554) 1.456906 / 1.541195 (-0.084288) 1.467609 / 1.468490 (-0.000881) 0.718726 / 4.584777 (-3.866051) 0.948157 / 3.745712 (-2.797555) 2.953559 / 5.269862 (-2.316303) 1.895182 / 4.565676 (-2.670494) 0.078380 / 0.424275 (-0.345895) 0.005640 / 0.007607 (-0.001968) 0.352978 / 0.226044 (0.126933) 3.436341 / 2.268929 (1.167413) 1.962418 / 55.444624 (-53.482206) 1.655444 / 6.876477 (-5.221033) 1.680082 / 2.142072 (-0.461990) 0.792920 / 4.805227 (-4.012307) 0.133518 / 6.500664 (-6.367146) 0.041123 / 0.075469 (-0.034346)

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.022546 / 1.841788 (-0.819242) 12.076711 / 8.074308 (4.002402) 10.159920 / 10.191392 (-0.031472) 0.143709 / 0.680424 (-0.536715) 0.015499 / 0.534201 (-0.518702) 0.302096 / 0.579283 (-0.277187) 0.125202 / 0.434364 (-0.309162) 0.349499 / 0.540337 (-0.190839) 0.456019 / 1.386936 (-0.930917)

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.

2 participants