Skip to content

Commit

Permalink
Fix Counter import (#2580)
Browse files Browse the repository at this point in the history
  • Loading branch information
albertvillanova authored Jul 2, 2021
1 parent adc8042 commit 8f8898c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/datasets/arrow_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
import os
import shutil
import tempfile
from collections import defaultdict
from collections import Counter, defaultdict
from collections.abc import Iterable, Mapping
from copy import deepcopy
from dataclasses import asdict
from functools import partial, wraps
from math import ceil, floor
from pathlib import Path
from typing import TYPE_CHECKING, Any, BinaryIO, Callable, Counter, Dict, Iterator, List, Optional, Tuple, Union
from typing import TYPE_CHECKING, Any, BinaryIO, Callable, Dict, Iterator, List, Optional, Tuple, Union

import fsspec
import numpy as np
Expand Down

1 comment on commit 8f8898c

@github-actions
Copy link

Choose a reason for hiding this comment

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

Show benchmarks

PyArrow==3.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.012077 / 0.011353 (0.000724) 0.004222 / 0.011008 (-0.006786) 0.041253 / 0.038508 (0.002745) 0.151437 / 0.023109 (0.128328) 0.375442 / 0.275898 (0.099544) 0.403761 / 0.323480 (0.080281) 0.011310 / 0.007986 (0.003325) 0.004142 / 0.004328 (-0.000186) 0.012193 / 0.004250 (0.007942) 0.068880 / 0.037052 (0.031828) 0.352072 / 0.258489 (0.093583) 0.452288 / 0.293841 (0.158447) 0.034822 / 0.128546 (-0.093724) 0.012260 / 0.075646 (-0.063387) 0.322721 / 0.419271 (-0.096551) 2.179019 / 0.043533 (2.135486) 0.342922 / 0.255139 (0.087783) 0.379053 / 0.283200 (0.095853) 0.090824 / 0.141683 (-0.050859) 1.892490 / 1.452155 (0.440335) 1.952367 / 1.492716 (0.459651)

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.020983 / 0.018006 (0.002977) 0.553091 / 0.000490 (0.552601) 0.004872 / 0.000200 (0.004672) 0.000454 / 0.000054 (0.000400)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.045486 / 0.037411 (0.008075) 0.029773 / 0.014526 (0.015247) 0.034873 / 0.176557 (-0.141683) 0.159583 / 0.737135 (-0.577553) 0.034988 / 0.296338 (-0.261350)

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.488332 / 0.215209 (0.273123) 4.902137 / 2.077655 (2.824482) 2.194232 / 1.504120 (0.690112) 1.877355 / 1.541195 (0.336160) 1.941578 / 1.468490 (0.473088) 0.501447 / 4.584777 (-4.083330) 6.474621 / 3.745712 (2.728909) 2.411258 / 5.269862 (-2.858604) 1.329628 / 4.565676 (-3.236048) 0.057631 / 0.424275 (-0.366644) 0.005356 / 0.007607 (-0.002251) 0.641529 / 0.226044 (0.415485) 6.532714 / 2.268929 (4.263786) 2.916009 / 55.444624 (-52.528616) 2.328077 / 6.876477 (-4.548400) 2.282008 / 2.142072 (0.139935) 0.696943 / 4.805227 (-4.108284) 0.147750 / 6.500664 (-6.352914) 0.061154 / 0.075469 (-0.014316)

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) 15.550043 / 1.841788 (13.708255) 15.086435 / 8.074308 (7.012127) 42.010911 / 10.191392 (31.819519) 0.928610 / 0.680424 (0.248186) 0.632268 / 0.534201 (0.098067) 0.277308 / 0.579283 (-0.301975) 0.689485 / 0.434364 (0.255121) 0.227362 / 0.540337 (-0.312975) 1.096819 / 1.386936 (-0.290117)
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.012802 / 0.011353 (0.001449) 0.004351 / 0.011008 (-0.006658) 0.039319 / 0.038508 (0.000810) 0.134766 / 0.023109 (0.111657) 0.366983 / 0.275898 (0.091085) 0.405146 / 0.323480 (0.081667) 0.010677 / 0.007986 (0.002692) 0.004033 / 0.004328 (-0.000296) 0.010872 / 0.004250 (0.006621) 0.059015 / 0.037052 (0.021963) 0.374989 / 0.258489 (0.116500) 0.404157 / 0.293841 (0.110316) 0.034335 / 0.128546 (-0.094211) 0.011990 / 0.075646 (-0.063657) 0.340093 / 0.419271 (-0.079178) 2.171654 / 0.043533 (2.128121) 0.356412 / 0.255139 (0.101273) 0.393739 / 0.283200 (0.110540) 0.090964 / 0.141683 (-0.050719) 1.806250 / 1.452155 (0.354095) 1.961109 / 1.492716 (0.468392)

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.076944 / 0.018006 (0.058938) 0.558195 / 0.000490 (0.557705) 0.010824 / 0.000200 (0.010624) 0.000343 / 0.000054 (0.000288)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.040583 / 0.037411 (0.003172) 0.028121 / 0.014526 (0.013595) 0.029307 / 0.176557 (-0.147250) 0.138749 / 0.737135 (-0.598386) 0.029594 / 0.296338 (-0.266745)

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.515887 / 0.215209 (0.300678) 5.240184 / 2.077655 (3.162529) 2.438534 / 1.504120 (0.934414) 2.127862 / 1.541195 (0.586667) 2.075327 / 1.468490 (0.606837) 0.512376 / 4.584777 (-4.072401) 6.460188 / 3.745712 (2.714476) 2.524442 / 5.269862 (-2.745419) 1.249265 / 4.565676 (-3.316411) 0.056479 / 0.424275 (-0.367796) 0.005742 / 0.007607 (-0.001865) 0.639469 / 0.226044 (0.413425) 6.771384 / 2.268929 (4.502455) 3.122012 / 55.444624 (-52.322613) 2.451733 / 6.876477 (-4.424743) 2.510180 / 2.142072 (0.368108) 0.716928 / 4.805227 (-4.088299) 0.148595 / 6.500664 (-6.352069) 0.064191 / 0.075469 (-0.011278)

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) 15.676141 / 1.841788 (13.834353) 15.662334 / 8.074308 (7.588025) 41.590397 / 10.191392 (31.399005) 0.931762 / 0.680424 (0.251338) 0.637498 / 0.534201 (0.103297) 0.288197 / 0.579283 (-0.291087) 0.704919 / 0.434364 (0.270555) 0.236314 / 0.540337 (-0.304023) 1.211259 / 1.386936 (-0.175677)

CML watermark

Please sign in to comment.