Skip to content

Commit

Permalink
Fix bug related to boolean in GAP dataset. (#680)
Browse files Browse the repository at this point in the history
* fix bug related to boolean

The value in row["A-coref"] and row["B-coref"] is 'TRUE' or 'FALSE'.
This type is `string`, then bool('FALSE') is equal to True in Python.
So, both rows are transformed into `True` now.

So, I modified this problem.

* modified single quotes to double quotes

* update gap information in datasets/gap/dataset_infos.json
  • Loading branch information
otakumesi authored Sep 29, 2020
1 parent a3576b4 commit c1ed514
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion datasets/gap/dataset_infos.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"default": {"description": "\nGAP is a gender-balanced dataset containing 8,908 coreference-labeled pairs of \n(ambiguous pronoun, antecedent name), sampled from Wikipedia and released by \nGoogle AI Language for the evaluation of coreference resolution in practical \napplications.\n", "citation": "\n@article{DBLP:journals/corr/abs-1810-05201,\n author = {Kellie Webster and\n Marta Recasens and\n Vera Axelrod and\n Jason Baldridge},\n title = {Mind the {GAP:} {A} Balanced Corpus of Gendered Ambiguous Pronouns},\n journal = {CoRR},\n volume = {abs/1810.05201},\n year = {2018},\n url = {http://arxiv.org/abs/1810.05201},\n archivePrefix = {arXiv},\n eprint = {1810.05201},\n timestamp = {Tue, 30 Oct 2018 20:39:56 +0100},\n biburl = {https://dblp.org/rec/bib/journals/corr/abs-1810-05201},\n bibsource = {dblp computer science bibliography, https://dblp.org}\n}\n", "homepage": "https://github.com/google-research-datasets/gap-coreference", "license": "", "features": {"ID": {"dtype": "string", "id": null, "_type": "Value"}, "Text": {"dtype": "string", "id": null, "_type": "Value"}, "Pronoun": {"dtype": "string", "id": null, "_type": "Value"}, "Pronoun-offset": {"dtype": "int32", "id": null, "_type": "Value"}, "A": {"dtype": "string", "id": null, "_type": "Value"}, "A-offset": {"dtype": "int32", "id": null, "_type": "Value"}, "A-coref": {"dtype": "bool", "id": null, "_type": "Value"}, "B": {"dtype": "string", "id": null, "_type": "Value"}, "B-offset": {"dtype": "int32", "id": null, "_type": "Value"}, "B-coref": {"dtype": "bool", "id": null, "_type": "Value"}, "URL": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "gap", "config_name": "default", "version": {"version_str": "0.1.0", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 1093462, "num_examples": 2000, "dataset_name": "gap"}, "train": {"name": "train", "num_bytes": 1098623, "num_examples": 2000, "dataset_name": "gap"}, "validation": {"name": "validation", "num_bytes": 249013, "num_examples": 454, "dataset_name": "gap"}}, "download_checksums": {"https://raw.githubusercontent.com/google-research-datasets/gap-coreference/master/gap-development.tsv": {"num_bytes": 1080993, "checksum": "b9a01434fcf58d8c2f9bc762480c27e58ce466cf1ffe8b09cfecbc7a20d2d634"}, "https://raw.githubusercontent.com/google-research-datasets/gap-coreference/master/gap-validation.tsv": {"num_bytes": 245089, "checksum": "2d784f66b390404f554704b9aef6dcde8845e79dda9886b8391cf7e9a24fdb98"}, "https://raw.githubusercontent.com/google-research-datasets/gap-coreference/master/gap-test.tsv": {"num_bytes": 1075889, "checksum": "1c35e36d5b14f6313ec3f6cd67b275de282595dd59e59390e00cfff9897a6819"}}, "download_size": 2401971, "dataset_size": 2441098, "size_in_bytes": 4843069}}
{"default": {"description": "\nGAP is a gender-balanced dataset containing 8,908 coreference-labeled pairs of\n(ambiguous pronoun, antecedent name), sampled from Wikipedia and released by\nGoogle AI Language for the evaluation of coreference resolution in practical\napplications.\n", "citation": "\n@article{DBLP:journals/corr/abs-1810-05201,\n author = {Kellie Webster and\n Marta Recasens and\n Vera Axelrod and\n Jason Baldridge},\n title = {Mind the {GAP:} {A} Balanced Corpus of Gendered Ambiguous Pronouns},\n journal = {CoRR},\n volume = {abs/1810.05201},\n year = {2018},\n url = {http://arxiv.org/abs/1810.05201},\n archivePrefix = {arXiv},\n eprint = {1810.05201},\n timestamp = {Tue, 30 Oct 2018 20:39:56 +0100},\n biburl = {https://dblp.org/rec/bib/journals/corr/abs-1810-05201},\n bibsource = {dblp computer science bibliography, https://dblp.org}\n}\n", "homepage": "https://github.com/google-research-datasets/gap-coreference", "license": "", "features": {"ID": {"dtype": "string", "id": null, "_type": "Value"}, "Text": {"dtype": "string", "id": null, "_type": "Value"}, "Pronoun": {"dtype": "string", "id": null, "_type": "Value"}, "Pronoun-offset": {"dtype": "int32", "id": null, "_type": "Value"}, "A": {"dtype": "string", "id": null, "_type": "Value"}, "A-offset": {"dtype": "int32", "id": null, "_type": "Value"}, "A-coref": {"dtype": "bool", "id": null, "_type": "Value"}, "B": {"dtype": "string", "id": null, "_type": "Value"}, "B-offset": {"dtype": "int32", "id": null, "_type": "Value"}, "B-coref": {"dtype": "bool", "id": null, "_type": "Value"}, "URL": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "gap", "config_name": "default", "version": {"version_str": "0.1.0", "description": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1095623, "num_examples": 2000, "dataset_name": "gap"}, "validation": {"name": "validation", "num_bytes": 248329, "num_examples": 454, "dataset_name": "gap"}, "test": {"name": "test", "num_bytes": 1090462, "num_examples": 2000, "dataset_name": "gap"}}, "download_checksums": {"https://raw.githubusercontent.com/google-research-datasets/gap-coreference/master/gap-development.tsv": {"num_bytes": 1080993, "checksum": "b9a01434fcf58d8c2f9bc762480c27e58ce466cf1ffe8b09cfecbc7a20d2d634"}, "https://raw.githubusercontent.com/google-research-datasets/gap-coreference/master/gap-validation.tsv": {"num_bytes": 245089, "checksum": "2d784f66b390404f554704b9aef6dcde8845e79dda9886b8391cf7e9a24fdb98"}, "https://raw.githubusercontent.com/google-research-datasets/gap-coreference/master/gap-test.tsv": {"num_bytes": 1075889, "checksum": "1c35e36d5b14f6313ec3f6cd67b275de282595dd59e59390e00cfff9897a6819"}}, "download_size": 2401971, "post_processing_size": null, "dataset_size": 2434414, "size_in_bytes": 4836385}}
4 changes: 2 additions & 2 deletions datasets/gap/gap.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ def _generate_examples(self, filepath):
with open(filepath, encoding="utf-8") as tsvfile:
reader = csv.DictReader(tsvfile, dialect="excel-tab")
for i, row in enumerate(reader):
row["A-coref"] = bool(row["A-coref"])
row["B-coref"] = bool(row["B-coref"])
row["A-coref"] = row["A-coref"] == "TRUE"
row["B-coref"] = row["B-coref"] == "TRUE"
row["A-offset"] = int(row["A-offset"])
row["B-offset"] = int(row["B-offset"])
row["Pronoun-offset"] = int(row["Pronoun-offset"])
Expand Down

1 comment on commit c1ed514

@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==0.17.1

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.015857 / 0.011353 (0.004504) 0.015650 / 0.011008 (0.004641) 0.050959 / 0.038508 (0.012450) 0.031209 / 0.023109 (0.008100) 0.196805 / 0.275898 (-0.079093) 0.233797 / 0.323480 (-0.089683) 0.010615 / 0.007986 (0.002630) 0.004461 / 0.004328 (0.000132) 0.006076 / 0.004250 (0.001825) 0.049092 / 0.037052 (0.012040) 0.208041 / 0.258489 (-0.050448) 0.229128 / 0.293841 (-0.064713) 0.138000 / 0.128546 (0.009454) 0.109502 / 0.075646 (0.033856) 0.449804 / 0.419271 (0.030533) 0.477445 / 0.043533 (0.433912) 0.200022 / 0.255139 (-0.055117) 0.211020 / 0.283200 (-0.072180) 0.081865 / 0.141683 (-0.059818) 1.804031 / 1.452155 (0.351876) 1.766026 / 1.492716 (0.273310)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.038426 / 0.037411 (0.001015) 0.020158 / 0.014526 (0.005632) 0.026416 / 0.176557 (-0.150140) 0.089909 / 0.737135 (-0.647226) 0.025917 / 0.296338 (-0.270421)

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.174417 / 0.215209 (-0.040792) 1.803149 / 2.077655 (-0.274506) 1.198572 / 1.504120 (-0.305548) 1.056441 / 1.541195 (-0.484753) 1.158751 / 1.468490 (-0.309739) 5.747384 / 4.584777 (1.162607) 4.555106 / 3.745712 (0.809394) 7.197780 / 5.269862 (1.927919) 6.344478 / 4.565676 (1.778802) 0.614410 / 0.424275 (0.190135) 0.011396 / 0.007607 (0.003789) 0.220879 / 0.226044 (-0.005165) 2.294367 / 2.268929 (0.025438) 1.562713 / 55.444624 (-53.881912) 1.459600 / 6.876477 (-5.416877) 1.501776 / 2.142072 (-0.640296) 5.991599 / 4.805227 (1.186372) 8.421318 / 6.500664 (1.920654) 6.763309 / 0.075469 (6.687840)

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) 11.327007 / 1.841788 (9.485219) 14.011134 / 8.074308 (5.936826) 11.837517 / 10.191392 (1.646125) 0.798621 / 0.680424 (0.118197) 0.251849 / 0.534201 (-0.282352) 0.711555 / 0.579283 (0.132272) 0.493190 / 0.434364 (0.058826) 0.681212 / 0.540337 (0.140875) 1.423268 / 1.386936 (0.036332)
PyArrow==1.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.015204 / 0.011353 (0.003851) 0.014452 / 0.011008 (0.003444) 0.054052 / 0.038508 (0.015543) 0.032213 / 0.023109 (0.009103) 0.358321 / 0.275898 (0.082423) 0.334948 / 0.323480 (0.011468) 0.007985 / 0.007986 (-0.000000) 0.004731 / 0.004328 (0.000403) 0.009526 / 0.004250 (0.005276) 0.047218 / 0.037052 (0.010166) 0.369534 / 0.258489 (0.111045) 0.378052 / 0.293841 (0.084211) 0.143016 / 0.128546 (0.014470) 0.109429 / 0.075646 (0.033783) 0.445808 / 0.419271 (0.026536) 0.423891 / 0.043533 (0.380358) 0.351056 / 0.255139 (0.095917) 0.319121 / 0.283200 (0.035922) 0.096680 / 0.141683 (-0.045003) 1.767455 / 1.452155 (0.315300) 1.641332 / 1.492716 (0.148616)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.043871 / 0.037411 (0.006459) 0.020992 / 0.014526 (0.006466) 0.052044 / 0.176557 (-0.124512) 0.092602 / 0.737135 (-0.644533) 0.049446 / 0.296338 (-0.246893)

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.235508 / 0.215209 (0.020298) 2.342110 / 2.077655 (0.264455) 1.787558 / 1.504120 (0.283438) 1.809348 / 1.541195 (0.268153) 1.788427 / 1.468490 (0.319936) 6.059245 / 4.584777 (1.474468) 4.726928 / 3.745712 (0.981216) 7.159666 / 5.269862 (1.889804) 6.260395 / 4.565676 (1.694719) 0.574161 / 0.424275 (0.149885) 0.010494 / 0.007607 (0.002887) 0.262962 / 0.226044 (0.036918) 2.695049 / 2.268929 (0.426120) 2.200529 / 55.444624 (-53.244095) 2.122322 / 6.876477 (-4.754155) 2.023874 / 2.142072 (-0.118198) 5.598677 / 4.805227 (0.793450) 4.048931 / 6.500664 (-2.451733) 6.151564 / 0.075469 (6.076095)

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) 12.210250 / 1.841788 (10.368462) 15.250734 / 8.074308 (7.176426) 12.157391 / 10.191392 (1.965999) 1.143337 / 0.680424 (0.462914) 0.554813 / 0.534201 (0.020612) 0.740786 / 0.579283 (0.161503) 0.507143 / 0.434364 (0.072779) 0.701899 / 0.540337 (0.161561) 1.532905 / 1.386936 (0.145969)

Please sign in to comment.