Skip to content

Commit

Permalink
Minor fix again
Browse files Browse the repository at this point in the history
  • Loading branch information
mariosasko committed Oct 3, 2022
1 parent bf783f2 commit 45b61c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Expand Up @@ -2,14 +2,15 @@
import itertools
import os
from dataclasses import dataclass
from typing import Any, List, Optional, Tuple
from typing import List, Optional, Tuple

import pandas as pd
import pyarrow as pa
import pyarrow.compute as pc
import pyarrow.json as paj

import datasets
from datasets.features.features import FeatureType
from datasets.tasks.base import TaskTemplate


Expand Down Expand Up @@ -66,7 +67,7 @@ class FolderBasedBuilder(datasets.GeneratorBasedBuilder):
CLASSIFICATION_TASK: classification task to use if labels are obtained from the folder structure
"""

BASE_FEATURE: Any
BASE_FEATURE: FeatureType
BASE_COLUMN_NAME: str
BUILDER_CONFIG_CLASS: FolderBasedBuilderConfig
EXTENSIONS: List[str]
Expand Down
3 changes: 2 additions & 1 deletion tests/packaged_modules/test_folder_based_builder.py
Expand Up @@ -11,14 +11,15 @@
FolderBasedBuilder,
FolderBasedBuilderConfig,
)
from datasets.tasks import TextClassification


class DummyFolderBasedBuilder(FolderBasedBuilder):
BASE_FEATURE = None
BASE_COLUMN_NAME = "base"
BUILDER_CONFIG_CLASS = FolderBasedBuilderConfig
EXTENSIONS = [".txt"]
CLASSIFICATION_TASK = None
CLASSIFICATION_TASK = TextClassification(text_column="base", label_column="label")


@pytest.fixture
Expand Down

1 comment on commit 45b61c1

@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==6.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.007259 / 0.011353 (-0.004093) 0.003406 / 0.011008 (-0.007602) 0.030581 / 0.038508 (-0.007927) 0.034782 / 0.023109 (0.011672) 0.286612 / 0.275898 (0.010714) 0.345630 / 0.323480 (0.022150) 0.005742 / 0.007986 (-0.002243) 0.004874 / 0.004328 (0.000546) 0.006756 / 0.004250 (0.002506) 0.045468 / 0.037052 (0.008416) 0.316502 / 0.258489 (0.058013) 0.356402 / 0.293841 (0.062561) 0.030915 / 0.128546 (-0.097631) 0.009783 / 0.075646 (-0.065864) 0.272970 / 0.419271 (-0.146301) 0.054208 / 0.043533 (0.010675) 0.304788 / 0.255139 (0.049649) 0.344264 / 0.283200 (0.061064) 0.107688 / 0.141683 (-0.033995) 1.464798 / 1.452155 (0.012643) 1.561602 / 1.492716 (0.068886)

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.219035 / 0.018006 (0.201029) 0.456556 / 0.000490 (0.456066) 0.002994 / 0.000200 (0.002794) 0.000160 / 0.000054 (0.000106)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.023766 / 0.037411 (-0.013645) 0.108324 / 0.014526 (0.093799) 0.112930 / 0.176557 (-0.063627) 0.160796 / 0.737135 (-0.576340) 0.121046 / 0.296338 (-0.175293)

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.409859 / 0.215209 (0.194649) 4.100611 / 2.077655 (2.022956) 1.908456 / 1.504120 (0.404336) 1.710978 / 1.541195 (0.169783) 1.650932 / 1.468490 (0.182442) 0.441212 / 4.584777 (-4.143565) 3.999997 / 3.745712 (0.254285) 3.452994 / 5.269862 (-1.816868) 1.797543 / 4.565676 (-2.768133) 0.052504 / 0.424275 (-0.371771) 0.011110 / 0.007607 (0.003503) 0.549883 / 0.226044 (0.323839) 5.112147 / 2.268929 (2.843219) 2.267954 / 55.444624 (-53.176671) 1.914655 / 6.876477 (-4.961822) 1.962964 / 2.142072 (-0.179108) 0.541190 / 4.805227 (-4.264037) 0.119386 / 6.500664 (-6.381278) 0.061080 / 0.075469 (-0.014389)

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.485245 / 1.841788 (-0.356543) 13.856915 / 8.074308 (5.782607) 24.834444 / 10.191392 (14.643052) 0.907003 / 0.680424 (0.226579) 0.563830 / 0.534201 (0.029629) 0.398026 / 0.579283 (-0.181258) 0.431336 / 0.434364 (-0.003028) 0.266826 / 0.540337 (-0.273511) 0.273073 / 1.386936 (-1.113864)
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.006789 / 0.011353 (-0.004564) 0.004016 / 0.011008 (-0.006992) 0.028587 / 0.038508 (-0.009921) 0.038890 / 0.023109 (0.015780) 0.412361 / 0.275898 (0.136463) 0.469247 / 0.323480 (0.145767) 0.004381 / 0.007986 (-0.003604) 0.003774 / 0.004328 (-0.000554) 0.005258 / 0.004250 (0.001007) 0.043134 / 0.037052 (0.006082) 0.417348 / 0.258489 (0.158859) 0.445112 / 0.293841 (0.151271) 0.032027 / 0.128546 (-0.096519) 0.010745 / 0.075646 (-0.064901) 0.255185 / 0.419271 (-0.164087) 0.070944 / 0.043533 (0.027411) 0.412710 / 0.255139 (0.157571) 0.412613 / 0.283200 (0.129413) 0.113739 / 0.141683 (-0.027944) 1.596522 / 1.452155 (0.144368) 1.615045 / 1.492716 (0.122329)

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.239781 / 0.018006 (0.221775) 0.470260 / 0.000490 (0.469770) 0.005159 / 0.000200 (0.004959) 0.000092 / 0.000054 (0.000037)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.022301 / 0.037411 (-0.015111) 0.105174 / 0.014526 (0.090648) 0.116484 / 0.176557 (-0.060073) 0.171256 / 0.737135 (-0.565879) 0.122391 / 0.296338 (-0.173948)

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.429612 / 0.215209 (0.214403) 4.410309 / 2.077655 (2.332655) 2.224599 / 1.504120 (0.720479) 2.051024 / 1.541195 (0.509829) 2.104209 / 1.468490 (0.635718) 0.434657 / 4.584777 (-4.150120) 3.998523 / 3.745712 (0.252811) 3.543272 / 5.269862 (-1.726590) 1.871994 / 4.565676 (-2.693683) 0.052074 / 0.424275 (-0.372201) 0.011845 / 0.007607 (0.004238) 0.556703 / 0.226044 (0.330659) 5.536491 / 2.268929 (3.267563) 2.722215 / 55.444624 (-52.722409) 2.360501 / 6.876477 (-4.515976) 2.447950 / 2.142072 (0.305877) 0.540273 / 4.805227 (-4.264954) 0.118939 / 6.500664 (-6.381725) 0.062268 / 0.075469 (-0.013201)

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.618902 / 1.841788 (-0.222886) 14.415695 / 8.074308 (6.341386) 25.447991 / 10.191392 (15.256599) 0.971169 / 0.680424 (0.290746) 0.645008 / 0.534201 (0.110807) 0.405883 / 0.579283 (-0.173400) 0.441870 / 0.434364 (0.007506) 0.260419 / 0.540337 (-0.279918) 0.277381 / 1.386936 (-1.109555)

CML watermark

Please sign in to comment.