PramitM beyond commited on
Commit
c988340
·
verified ·
0 Parent(s):

Duplicate from Hello-SimpleAI/HC3

Browse files

Co-authored-by: beyond <beyond@users.noreply.huggingface.co>

Files changed (9) hide show
  1. .gitattributes +56 -0
  2. HC3.py +187 -0
  3. README.md +54 -0
  4. all.jsonl +3 -0
  5. finance.jsonl +0 -0
  6. medicine.jsonl +0 -0
  7. open_qa.jsonl +0 -0
  8. reddit_eli5.jsonl +3 -0
  9. wiki_csai.jsonl +0 -0
.gitattributes ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
12
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
13
+ *.model filter=lfs diff=lfs merge=lfs -text
14
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
15
+ *.npy filter=lfs diff=lfs merge=lfs -text
16
+ *.npz filter=lfs diff=lfs merge=lfs -text
17
+ *.onnx filter=lfs diff=lfs merge=lfs -text
18
+ *.ot filter=lfs diff=lfs merge=lfs -text
19
+ *.parquet filter=lfs diff=lfs merge=lfs -text
20
+ *.pb filter=lfs diff=lfs merge=lfs -text
21
+ *.pickle filter=lfs diff=lfs merge=lfs -text
22
+ *.pkl filter=lfs diff=lfs merge=lfs -text
23
+ *.pt filter=lfs diff=lfs merge=lfs -text
24
+ *.pth filter=lfs diff=lfs merge=lfs -text
25
+ *.rar filter=lfs diff=lfs merge=lfs -text
26
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
27
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ # Audio files - uncompressed
37
+ *.pcm filter=lfs diff=lfs merge=lfs -text
38
+ *.sam filter=lfs diff=lfs merge=lfs -text
39
+ *.raw filter=lfs diff=lfs merge=lfs -text
40
+ # Audio files - compressed
41
+ *.aac filter=lfs diff=lfs merge=lfs -text
42
+ *.flac filter=lfs diff=lfs merge=lfs -text
43
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
44
+ *.ogg filter=lfs diff=lfs merge=lfs -text
45
+ *.wav filter=lfs diff=lfs merge=lfs -text
46
+ # Image files - uncompressed
47
+ *.bmp filter=lfs diff=lfs merge=lfs -text
48
+ *.gif filter=lfs diff=lfs merge=lfs -text
49
+ *.png filter=lfs diff=lfs merge=lfs -text
50
+ *.tiff filter=lfs diff=lfs merge=lfs -text
51
+ # Image files - compressed
52
+ *.jpg filter=lfs diff=lfs merge=lfs -text
53
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
54
+ *.webp filter=lfs diff=lfs merge=lfs -text
55
+ all.jsonl filter=lfs diff=lfs merge=lfs -text
56
+ reddit_eli5.jsonl filter=lfs diff=lfs merge=lfs -text
HC3.py ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ # TODO: Address all TODOs and remove all explanatory comments
15
+ """TODO: Add a description here."""
16
+
17
+
18
+ import csv
19
+ import json
20
+ import os
21
+
22
+ import datasets
23
+
24
+
25
+ # TODO: Add BibTeX citation
26
+ # Find for instance the citation on arxiv or on the dataset repo/website
27
+ _CITATION = """\
28
+
29
+ """
30
+
31
+ # TODO: Add description of the dataset here
32
+ # You can copy an official description
33
+ _DESCRIPTION = """\
34
+ Human ChatGPT Comparison Corpus (HC3)
35
+ """
36
+
37
+ # TODO: Add a link to an official homepage for the dataset here
38
+ _HOMEPAGE = "https://github.com/Hello-SimpleAI/chatgpt-comparison-detection"
39
+
40
+ # TODO: Add the licence for the dataset here if you can find it
41
+ _LICENSE = ""
42
+
43
+ # TODO: Add link to the official dataset URLs here
44
+ # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
45
+ # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
46
+ _BASE_URL = 'https://huggingface.co/datasets/Hello-SimpleAI/HC3/resolve/main/'
47
+ # _URLS = {
48
+ # "all":"https://huggingface.co/datasets/Hello-SimpleAI/chatgpt-comparison-corpus/resolve/main/en/all.jsonl",
49
+ # "reddit_eli5": "https://huggingface.co/datasets/Hello-SimpleAI/chatgpt-comparison-corpus/resolve/main/en/reddit_eli5.jsonl",
50
+ # "wikipedia_csai": "https://huggingface.co/datasets/Hello-SimpleAI/chatgpt-comparison-corpus/resolve/main/en/wikipedia_csai.jsonl",
51
+ # "open_questions": "https://huggingface.co/datasets/Hello-SimpleAI/chatgpt-comparison-corpus/resolve/main/en/open_questions.jsonl",
52
+ # "finance": "https://huggingface.co/datasets/Hello-SimpleAI/chatgpt-comparison-corpus/resolve/main/en/finance.jsonl",
53
+ # "medicine": "https://huggingface.co/datasets/Hello-SimpleAI/chatgpt-comparison-corpus/resolve/main/en/medicine.jsonl",
54
+ # }
55
+
56
+
57
+
58
+ # TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
59
+ class NewDataset(datasets.GeneratorBasedBuilder):
60
+ """Human ChatGPT Comparison Corpus (HC3)"""
61
+
62
+ VERSION = datasets.Version("1.1.0")
63
+
64
+ # This is an example of a dataset with multiple configurations.
65
+ # If you don't want/need to define several sub-sets in your dataset,
66
+ # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
67
+
68
+ # If you need to make complex sub-parts in the datasets with configurable options
69
+ # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
70
+ # BUILDER_CONFIG_CLASS = MyBuilderConfig
71
+
72
+ # You will be able to load one or the other configurations in the following list with
73
+ # data = datasets.load_dataset('my_dataset', 'first_domain')
74
+ # data = datasets.load_dataset('my_dataset', 'second_domain')
75
+ BUILDER_CONFIGS = [
76
+ datasets.BuilderConfig(name="all", version=VERSION, description="concatenation of all other subsets"),
77
+ datasets.BuilderConfig(name="reddit_eli5", version=VERSION, description="reddit"),
78
+ datasets.BuilderConfig(name="wiki_csai", version=VERSION, description="wiki"),
79
+ datasets.BuilderConfig(name="open_qa", version=VERSION, description="open_questions"),
80
+ datasets.BuilderConfig(name="finance", version=VERSION, description="finance"),
81
+ datasets.BuilderConfig(name="medicine", version=VERSION, description="medicine"),
82
+ ]
83
+
84
+ DEFAULT_CONFIG_NAME = "first_domain" # It's not mandatory to have a default configuration. Just use one if it make sense.
85
+
86
+ def _info(self):
87
+ # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
88
+ if self.config.name == "all": # This is the name of the configuration selected in BUILDER_CONFIGS above
89
+ features = datasets.Features(
90
+ {
91
+ "id":datasets.Value("string"),
92
+ "question": datasets.Value("string"),
93
+ "human_answers": datasets.Sequence(datasets.Value("string")),
94
+ "chatgpt_answers": datasets.Sequence(datasets.Value("string")),
95
+ "source": datasets.Value("string")
96
+ # These are the features of your dataset like images, labels ...
97
+ }
98
+ )
99
+ else: # This is an example to show how to have different features for "first_domain" and "second_domain"
100
+ features = datasets.Features(
101
+ {
102
+ "id":datasets.Value("string"),
103
+ "question": datasets.Value("string"),
104
+ "human_answers": datasets.Sequence(datasets.Value("string")),
105
+ "chatgpt_answers": datasets.Sequence(datasets.Value("string")),
106
+ # These are the features of your dataset like images, labels ...
107
+ }
108
+ )
109
+ return datasets.DatasetInfo(
110
+ # This is the description that will appear on the datasets page.
111
+ description=_DESCRIPTION,
112
+ # This defines the different columns of the dataset and their types
113
+ features=features, # Here we define them above because they are different between the two configurations
114
+ # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
115
+ # specify them. They'll be used if as_supervised=True in builder.as_dataset.
116
+ # supervised_keys=("sentence", "label"),
117
+ # Homepage of the dataset for documentation
118
+ homepage=_HOMEPAGE,
119
+ # License for the dataset if available
120
+ license=_LICENSE,
121
+ # Citation for the dataset
122
+ citation=_CITATION,
123
+ )
124
+
125
+ def _split_generators(self, dl_manager):
126
+ # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
127
+ # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
128
+
129
+ # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
130
+ # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
131
+ # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
132
+
133
+ # urls = _URLS[self.config.name]
134
+ urls = _BASE_URL+self.config.name+'.jsonl'
135
+ data_path = dl_manager.download_and_extract(urls) # for online datasets
136
+ # data_path = _URLS[self.config.name]
137
+ return [
138
+ datasets.SplitGenerator(
139
+ name=datasets.Split.TRAIN,
140
+ # These kwargs will be passed to _generate_examples
141
+ gen_kwargs={
142
+ # "filepath": os.path.join(data_dir, "train.jsonl"),
143
+ "filepath": data_path,
144
+ "split": "train",
145
+ },
146
+ ),
147
+ # datasets.SplitGenerator(
148
+ # name=datasets.Split.VALIDATION,
149
+ # # These kwargs will be passed to _generate_examples
150
+ # gen_kwargs={
151
+ # "filepath": os.path.join(data_dir, "dev.jsonl"),
152
+ # "split": "dev",
153
+ # },
154
+ # ),
155
+ # datasets.SplitGenerator(
156
+ # name=datasets.Split.TEST,
157
+ # # These kwargs will be passed to _generate_examples
158
+ # gen_kwargs={
159
+ # "filepath": os.path.join(data_dir, "test.jsonl"),
160
+ # "split": "test"
161
+ # },
162
+ # ),
163
+ ]
164
+
165
+ # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
166
+ def _generate_examples(self, filepath, split):
167
+ # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
168
+ # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
169
+ with open(filepath, encoding="utf-8") as f:
170
+ for key, row in enumerate(f):
171
+ data = json.loads(row)
172
+ if self.config.name == "all":
173
+ # Yields examples as (key, example) tuples
174
+ yield key, {
175
+ "id": key,
176
+ "question": data["question"],
177
+ "human_answers": data["human_answers"],
178
+ "chatgpt_answers": data["chatgpt_answers"],
179
+ "source": data["source"]
180
+ }
181
+ else:
182
+ yield key, {
183
+ "id": key,
184
+ "question": data["question"],
185
+ "human_answers": data["human_answers"],
186
+ "chatgpt_answers": data["chatgpt_answers"],
187
+ }
README.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ task_categories:
3
+ - text-classification
4
+ - question-answering
5
+ - sentence-similarity
6
+ - zero-shot-classification
7
+ language:
8
+ - en
9
+ - zh
10
+ tags:
11
+ - ChatGPT
12
+ - SimpleAI
13
+ - Detection
14
+ - OOD
15
+ size_categories:
16
+ - 10K<n<100K
17
+ license: cc-by-sa-4.0
18
+ ---
19
+
20
+
21
+ # Human ChatGPT Comparison Corpus (HC3)
22
+ We propose the first human-ChatGPT comparison corpus, named **HC3** dataset.
23
+
24
+ This dataset is introduced in our paper:
25
+ - Paper: [***How Close is ChatGPT to Human Experts? Comparison Corpus, Evaluation, and Detection***](https://arxiv.org/abs/2301.07597)
26
+
27
+ Code, models and analysis are available on our GitHub:
28
+ - GitHub: [**Chatgpt-Comparison-Detection project** 🔬](https://github.com/Hello-SimpleAI/chatgpt-comparison-detection)
29
+
30
+
31
+ # Dataset Copyright
32
+ If the source datasets used in this corpus has a specific license which is stricter than CC-BY-SA, our products follow the same. If not, they follow CC-BY-SA license.
33
+ See [dataset copyright](https://github.com/Hello-SimpleAI/chatgpt-comparison-detection#dataset-copyright).
34
+
35
+
36
+ # Citation
37
+
38
+ Checkout this papaer [arxiv: 2301.07597](https://arxiv.org/abs/2301.07597)
39
+
40
+ ```
41
+ @article{guo-etal-2023-hc3,
42
+ title = "How Close is ChatGPT to Human Experts? Comparison Corpus, Evaluation, and Detection",
43
+ author = "Guo, Biyang and
44
+ Zhang, Xin and
45
+ Wang, Ziyuan and
46
+ Jiang, Minqi and
47
+ Nie, Jinran and
48
+ Ding, Yuxuan and
49
+ Yue, Jianwei and
50
+ Wu, Yupeng",
51
+ journal={arXiv preprint arxiv:2301.07597}
52
+ year = "2023",
53
+ }
54
+ ```
all.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee231f82283d754050a4dc58ecf9331afaf5daea7283c6da0b096ed0fb2774cf
3
+ size 73722850
finance.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
medicine.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
open_qa.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
reddit_eli5.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:448cebaf7fdf27560daf6cc87cc1464be4988cf8110c0ec40c40b21c2c0193db
3
+ size 55448695
wiki_csai.jsonl ADDED
The diff for this file is too large to render. See raw diff