Skip to content

Commit

Permalink
Fix ValueError message formatting in int2str (#3742)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaakulchyk authored Feb 17, 2022
1 parent 6103a62 commit 9039a0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/datasets/features/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ def int2str(self, values: Union[int, Iterable]):
"""Conversion integer => class name string."""
if not isinstance(values, int) and not isinstance(values, Iterable):
raise ValueError(
"Values {values} should be an integer or an Iterable (list, numpy array, pytorch, tensorflow tensors)"
f"Values {values} should be an integer or an Iterable (list, numpy array, pytorch, tensorflow tensors)"
)
return_list = True
if isinstance(values, int):
Expand Down

1 comment on commit 9039a0f

@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.009389 / 0.011353 (-0.001964) 0.003813 / 0.011008 (-0.007195) 0.031123 / 0.038508 (-0.007385) 0.034310 / 0.023109 (0.011201) 0.329751 / 0.275898 (0.053853) 0.352148 / 0.323480 (0.028668) 0.007757 / 0.007986 (-0.000228) 0.003347 / 0.004328 (-0.000981) 0.008956 / 0.004250 (0.004705) 0.041560 / 0.037052 (0.004508) 0.321551 / 0.258489 (0.063062) 0.362340 / 0.293841 (0.068499) 0.031430 / 0.128546 (-0.097116) 0.009715 / 0.075646 (-0.065932) 0.254813 / 0.419271 (-0.164459) 0.050281 / 0.043533 (0.006748) 0.315327 / 0.255139 (0.060188) 0.355417 / 0.283200 (0.072218) 0.100209 / 0.141683 (-0.041474) 1.777143 / 1.452155 (0.324988) 1.835066 / 1.492716 (0.342350)

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.314867 / 0.018006 (0.296861) 0.436059 / 0.000490 (0.435569) 0.041274 / 0.000200 (0.041074) 0.000514 / 0.000054 (0.000460)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.028845 / 0.037411 (-0.008566) 0.104326 / 0.014526 (0.089800) 0.115624 / 0.176557 (-0.060932) 0.162344 / 0.737135 (-0.574791) 0.114474 / 0.296338 (-0.181864)

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.425095 / 0.215209 (0.209886) 4.255156 / 2.077655 (2.177502) 1.841262 / 1.504120 (0.337142) 1.608048 / 1.541195 (0.066854) 1.649332 / 1.468490 (0.180842) 0.443131 / 4.584777 (-4.141646) 4.534057 / 3.745712 (0.788345) 2.142423 / 5.269862 (-3.127439) 0.897522 / 4.565676 (-3.668155) 0.053984 / 0.424275 (-0.370291) 0.012143 / 0.007607 (0.004536) 0.526665 / 0.226044 (0.300620) 5.293020 / 2.268929 (3.024091) 2.276521 / 55.444624 (-53.168103) 1.877947 / 6.876477 (-4.998530) 1.879127 / 2.142072 (-0.262945) 0.557961 / 4.805227 (-4.247266) 0.122281 / 6.500664 (-6.378383) 0.061770 / 0.075469 (-0.013699)

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.637033 / 1.841788 (-0.204754) 13.818687 / 8.074308 (5.744379) 26.902848 / 10.191392 (16.711456) 0.853992 / 0.680424 (0.173568) 0.522838 / 0.534201 (-0.011363) 0.492305 / 0.579283 (-0.086978) 0.500597 / 0.434364 (0.066233) 0.322837 / 0.540337 (-0.217501) 0.332674 / 1.386936 (-1.054262)
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.008075 / 0.011353 (-0.003278) 0.003752 / 0.011008 (-0.007256) 0.029089 / 0.038508 (-0.009419) 0.033700 / 0.023109 (0.010591) 0.297812 / 0.275898 (0.021914) 0.310551 / 0.323480 (-0.012929) 0.005931 / 0.007986 (-0.002054) 0.004683 / 0.004328 (0.000354) 0.007145 / 0.004250 (0.002894) 0.037149 / 0.037052 (0.000097) 0.280533 / 0.258489 (0.022044) 0.316328 / 0.293841 (0.022488) 0.030933 / 0.128546 (-0.097613) 0.009474 / 0.075646 (-0.066172) 0.249857 / 0.419271 (-0.169414) 0.050179 / 0.043533 (0.006647) 0.286776 / 0.255139 (0.031637) 0.322580 / 0.283200 (0.039380) 0.088502 / 0.141683 (-0.053181) 1.777207 / 1.452155 (0.325053) 1.832979 / 1.492716 (0.340263)

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.315350 / 0.018006 (0.297344) 0.439095 / 0.000490 (0.438605) 0.044989 / 0.000200 (0.044789) 0.000649 / 0.000054 (0.000595)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.026243 / 0.037411 (-0.011169) 0.101048 / 0.014526 (0.086522) 0.112450 / 0.176557 (-0.064107) 0.148334 / 0.737135 (-0.588801) 0.112649 / 0.296338 (-0.183689)

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.425484 / 0.215209 (0.210275) 4.245355 / 2.077655 (2.167700) 1.837724 / 1.504120 (0.333604) 1.608677 / 1.541195 (0.067482) 1.648664 / 1.468490 (0.180174) 0.444864 / 4.584777 (-4.139913) 4.623016 / 3.745712 (0.877304) 3.697365 / 5.269862 (-1.572497) 0.954755 / 4.565676 (-3.610921) 0.053801 / 0.424275 (-0.370474) 0.011825 / 0.007607 (0.004218) 0.526163 / 0.226044 (0.300118) 5.278816 / 2.268929 (3.009888) 2.309042 / 55.444624 (-53.135582) 1.927577 / 6.876477 (-4.948899) 1.995715 / 2.142072 (-0.146358) 0.571966 / 4.805227 (-4.233261) 0.124099 / 6.500664 (-6.376565) 0.061403 / 0.075469 (-0.014066)

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.615294 / 1.841788 (-0.226494) 13.618701 / 8.074308 (5.544393) 26.382988 / 10.191392 (16.191596) 0.870534 / 0.680424 (0.190110) 0.521492 / 0.534201 (-0.012709) 0.489892 / 0.579283 (-0.089392) 0.510060 / 0.434364 (0.075696) 0.316901 / 0.540337 (-0.223436) 0.339539 / 1.386936 (-1.047397)

CML watermark

Please sign in to comment.