Delete loading script
Browse files- civil_comments_helm.py +0 -75
civil_comments_helm.py
DELETED
@@ -1,75 +0,0 @@
|
|
1 |
-
import datasets
|
2 |
-
import os
|
3 |
-
import json
|
4 |
-
|
5 |
-
|
6 |
-
categories = ["male", "female", "LGBTQ", "christian", "muslim", "other_religions", "black", "white", "all"]
|
7 |
-
|
8 |
-
_CITATION = """
|
9 |
-
@inproceedings{wilds2021,
|
10 |
-
title = {{WILDS}: A Benchmark of in-the-Wild Distribution Shifts},
|
11 |
-
author = {Pang Wei Koh and Shiori Sagawa and Henrik Marklund and Sang Michael Xie and Marvin Zhang and
|
12 |
-
Akshay Balsubramani and Weihua Hu and Michihiro Yasunaga and Richard Lanas Phillips and Irena Gao and
|
13 |
-
Tony Lee and Etienne David and Ian Stavness and Wei Guo and Berton A. Earnshaw and Imran S. Haque and
|
14 |
-
Sara Beery and Jure Leskovec and Anshul Kundaje and Emma Pierson and Sergey Levine and Chelsea Finn
|
15 |
-
and Percy Liang},
|
16 |
-
booktitle = {International Conference on Machine Learning (ICML)},
|
17 |
-
year = {2021}
|
18 |
-
}
|
19 |
-
|
20 |
-
@inproceedings{borkan2019nuanced,
|
21 |
-
title={Nuanced metrics for measuring unintended bias with real data for text classification},
|
22 |
-
author={Borkan, Daniel and Dixon, Lucas and Sorensen, Jeffrey and Thain, Nithum and Vasserman, Lucy},
|
23 |
-
booktitle={Companion Proceedings of The 2019 World Wide Web Conference},
|
24 |
-
pages={491--500},
|
25 |
-
year={2019}
|
26 |
-
}"""
|
27 |
-
|
28 |
-
class CivilCommentsHELM(datasets.GeneratorBasedBuilder):
|
29 |
-
VERSION = datasets.Version("1.0.0")
|
30 |
-
|
31 |
-
BUILDER_CONFIGS = [
|
32 |
-
datasets.BuilderConfig(name=name, version=datasets.Version("1.0.0"), description="")
|
33 |
-
for name in categories
|
34 |
-
]
|
35 |
-
|
36 |
-
#"references": [{"output": "The gay couple", "tags": ["negative", "ambiguous", "B", "A", "C", "B"]}, {"output": "Not enough info", "tags": ["correct", "negative", "ambiguous", "B", "A", "C", "B"]}, {"output": "The pansexual couple", "tags": ["negative", "ambiguous", "B", "A", "C", "B"]}], "choices": ["The gay couple", "Not enough info", "The pansexual couple"], "gold_index": 1}
|
37 |
-
|
38 |
-
def _info(self):
|
39 |
-
features = datasets.Features(
|
40 |
-
{
|
41 |
-
"text": datasets.Value("string"),
|
42 |
-
"gold": datasets.Value("string"),
|
43 |
-
"sub_split": datasets.Value("string"),
|
44 |
-
|
45 |
-
}
|
46 |
-
)
|
47 |
-
return datasets.DatasetInfo(
|
48 |
-
description=f"Civil comments, as preprocessed and shuffled in HELM",
|
49 |
-
features=features,
|
50 |
-
homepage="",
|
51 |
-
license="",
|
52 |
-
citation=_CITATION,
|
53 |
-
)
|
54 |
-
|
55 |
-
def _split_generators(self, dl_manager):
|
56 |
-
train_json = dl_manager.download(os.path.join(self.config.name, "train.json"))
|
57 |
-
test_json = dl_manager.download(os.path.join(self.config.name, "test.json"))
|
58 |
-
|
59 |
-
return [
|
60 |
-
datasets.SplitGenerator(
|
61 |
-
name=datasets.Split.TRAIN,
|
62 |
-
gen_kwargs={"path": train_json},
|
63 |
-
),
|
64 |
-
datasets.SplitGenerator(
|
65 |
-
name=datasets.Split.TEST,
|
66 |
-
gen_kwargs={"path": test_json},
|
67 |
-
)
|
68 |
-
]
|
69 |
-
|
70 |
-
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
71 |
-
def _generate_examples(self, path):
|
72 |
-
with open(path, encoding="utf-8") as f:
|
73 |
-
for key, row in enumerate(f):
|
74 |
-
yield key, json.loads(row)
|
75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|