system HF staff commited on
Commit
6f2c008
0 Parent(s):

Update files from the datasets library (from 1.2.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.2.0

.gitattributes ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 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
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ language_creators:
5
+ - other
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - cc0-1-0
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 100K<n<1M
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - text-classification
18
+ task_ids:
19
+ - multi-label-classification
20
+ ---
21
+
22
+ # Dataset Card for [Dataset Name]
23
+
24
+ ## Table of Contents
25
+ - [Dataset Description](#dataset-description)
26
+ - [Dataset Summary](#dataset-summary)
27
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
28
+ - [Languages](#languages)
29
+ - [Dataset Structure](#dataset-structure)
30
+ - [Data Instances](#data-instances)
31
+ - [Data Fields](#data-instances)
32
+ - [Data Splits](#data-instances)
33
+ - [Dataset Creation](#dataset-creation)
34
+ - [Curation Rationale](#curation-rationale)
35
+ - [Source Data](#source-data)
36
+ - [Annotations](#annotations)
37
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
38
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
39
+ - [Social Impact of Dataset](#social-impact-of-dataset)
40
+ - [Discussion of Biases](#discussion-of-biases)
41
+ - [Other Known Limitations](#other-known-limitations)
42
+ - [Additional Information](#additional-information)
43
+ - [Dataset Curators](#dataset-curators)
44
+ - [Licensing Information](#licensing-information)
45
+ - [Citation Information](#citation-information)
46
+
47
+ ## Dataset Description
48
+
49
+ - **Homepage:** [Jigsaw Comment Toxicity Classification Kaggle Competition](https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge/data)
50
+ - **Repository:**
51
+ - **Paper:**
52
+ - **Leaderboard:**
53
+ - **Point of Contact:**
54
+
55
+ ### Dataset Summary
56
+
57
+ Discussing things you care about can be difficult. The threat of abuse and harassment online means that many people stop expressing themselves and give up on seeking different opinions. Platforms struggle to effectively facilitate conversations, leading many communities to limit or completely shut down user comments. This dataset consists of a large number of Wikipedia comments which have been labeled by human raters for toxic behavior.
58
+
59
+ ### Supported Tasks and Leaderboards
60
+
61
+ The dataset support multi-label classification
62
+
63
+ ### Languages
64
+
65
+ The comments are in English
66
+
67
+ ## Dataset Structure
68
+
69
+ ### Data Instances
70
+
71
+ A data point consists of a comment followed by multiple labels that can be associated with it.
72
+ {'id': '02141412314',
73
+ 'comment_text': 'Sample comment text',
74
+ 'toxic': 0,
75
+ 'severe_toxic': 0,
76
+ 'obscene': 0,
77
+ 'threat': 0,
78
+ 'insult': 0,
79
+ 'identity_hate': 1,
80
+ }
81
+
82
+ ### Data Fields
83
+
84
+ - `id`: id of the comment
85
+ - `comment_text`: the text of the comment
86
+ - `toxic`: value of 0(non-toxic) or 1(toxic) classifying the comment
87
+ - `severe_toxic`: value of 0(non-severe_toxic) or 1(severe_toxic) classifying the comment
88
+ - `obscene`: value of 0(non-obscene) or 1(obscene) classifying the comment
89
+ - `threat`: value of 0(non-threat) or 1(threat) classifying the comment
90
+ - `insult`: value of 0(non-insult) or 1(insult) classifying the comment
91
+ - `identity_hate`: value of 0(non-identity_hate) or 1(identity_hate) classifying the comment
92
+
93
+ ### Data Splits
94
+
95
+ The data is split into a training and testing set.
96
+
97
+ ## Dataset Creation
98
+
99
+ ### Curation Rationale
100
+
101
+ The dataset was created to help in efforts to identify and curb instances of toxicity online.
102
+
103
+ ### Source Data
104
+
105
+ #### Initial Data Collection and Normalization
106
+
107
+ The dataset is a collection of Wikipedia comments.
108
+
109
+ #### Who are the source language producers?
110
+
111
+ [More Information Needed]
112
+
113
+ ### Annotations
114
+
115
+ #### Annotation process
116
+
117
+ [More Information Needed]
118
+
119
+ #### Who are the annotators?
120
+
121
+ [More Information Needed]
122
+
123
+ ### Personal and Sensitive Information
124
+
125
+ [More Information Needed]
126
+
127
+ ## Considerations for Using the Data
128
+
129
+ ### Social Impact of Dataset
130
+
131
+ [More Information Needed]
132
+
133
+ ### Discussion of Biases
134
+
135
+ If words that are associated with swearing, insults or profanity are present in a comment, it is likely that it will be classified as toxic, regardless of the tone or the intent of the author e.g. humorous/self-deprecating. This could present some biases towards already vulnerable minority groups.
136
+
137
+ ### Other Known Limitations
138
+
139
+ [More Information Needed]
140
+
141
+ ## Additional Information
142
+
143
+ ### Dataset Curators
144
+
145
+ [More Information Needed]
146
+
147
+ ### Licensing Information
148
+
149
+ The "Toxic Comment Classification" dataset is released under [CC0], with the underlying comment text being governed by Wikipedia\'s [CC-SA-3.0].
150
+
151
+ ### Citation Information
152
+
153
+ [More Information Needed]
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"default": {"description": "This dataset consists of a large number of Wikipedia comments which have been labeled by human raters for toxic behavior.\n", "citation": "", "homepage": "https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge/data", "license": "The \"Toxic Comment Classification\" dataset is released under CC0, with the underlying comment text being governed by Wikipedia's CC-SA-3.0.", "features": {"comment_text": {"dtype": "string", "id": null, "_type": "Value"}, "toxic": {"num_classes": 2, "names": ["false", "true"], "names_file": null, "id": null, "_type": "ClassLabel"}, "severe_toxic": {"num_classes": 2, "names": ["false", "true"], "names_file": null, "id": null, "_type": "ClassLabel"}, "obscene": {"num_classes": 2, "names": ["false", "true"], "names_file": null, "id": null, "_type": "ClassLabel"}, "threat": {"num_classes": 2, "names": ["false", "true"], "names_file": null, "id": null, "_type": "ClassLabel"}, "insult": {"num_classes": 2, "names": ["false", "true"], "names_file": null, "id": null, "_type": "ClassLabel"}, "identity_hate": {"num_classes": 2, "names": ["false", "true"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "jigsaw_toxicity_pred", "config_name": "default", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 71282358, "num_examples": 159571, "dataset_name": "jigsaw_toxicity_pred"}, "test": {"name": "test", "num_bytes": 28241991, "num_examples": 63978, "dataset_name": "jigsaw_toxicity_pred"}}, "download_checksums": {}, "download_size": 0, "post_processing_size": null, "dataset_size": 99524349, "size_in_bytes": 99524349}}
dummy/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:95e1d17a5a1aec079fb0b836b00ab44eb9a72ab8c3322ed5c92ec6f611fbe33a
3
+ size 1429
jigsaw_toxicity_pred.py ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """Comments from Jigsaw Toxic Comment Classification Kaggle Competition """
16
+
17
+ from __future__ import absolute_import, division, print_function
18
+
19
+ import os
20
+
21
+ import pandas as pd
22
+
23
+ import datasets
24
+
25
+
26
+ _DESCRIPTION = """\
27
+ This dataset consists of a large number of Wikipedia comments which have been labeled by human raters for toxic behavior.
28
+ """
29
+
30
+ _HOMEPAGE = "https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge/data"
31
+
32
+ _LICENSE = 'The "Toxic Comment Classification" dataset is released under CC0, with the underlying comment text being governed by Wikipedia\'s CC-SA-3.0.'
33
+
34
+
35
+ class JigsawToxicityPred(datasets.GeneratorBasedBuilder):
36
+ """This is a dataset of comments from Wikipedia’s talk page edits which have been labeled by human raters for toxic behavior."""
37
+
38
+ VERSION = datasets.Version("1.1.0")
39
+
40
+ @property
41
+ def manual_download_instructions(self):
42
+ return """\
43
+ To use jigsaw_toxicity_pred you have to download it manually from Kaggle: https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge/data
44
+ You can manually download the data from it's homepage or use the Kaggle CLI tool (follow the instructions here: https://www.kaggle.com/docs/api)
45
+ Please extract all files in one folder and then load the dataset with:
46
+ `datasets.load_dataset('jigsaw_toxicity_pred', data_dir='/path/to/extracted/data/')`"""
47
+
48
+ def _info(self):
49
+
50
+ return datasets.DatasetInfo(
51
+ # This is the description that will appear on the datasets page.
52
+ description=_DESCRIPTION,
53
+ # This defines the different columns of the dataset and their types
54
+ features=datasets.Features(
55
+ {
56
+ "comment_text": datasets.Value("string"),
57
+ "toxic": datasets.ClassLabel(names=["false", "true"]),
58
+ "severe_toxic": datasets.ClassLabel(names=["false", "true"]),
59
+ "obscene": datasets.ClassLabel(names=["false", "true"]),
60
+ "threat": datasets.ClassLabel(names=["false", "true"]),
61
+ "insult": datasets.ClassLabel(names=["false", "true"]),
62
+ "identity_hate": datasets.ClassLabel(names=["false", "true"]),
63
+ }
64
+ ),
65
+ # If there's a common (input, target) tuple from the features,
66
+ # specify them here. They'll be used if as_supervised=True in
67
+ # builder.as_dataset.
68
+ supervised_keys=None,
69
+ # Homepage of the dataset for documentation
70
+ homepage=_HOMEPAGE,
71
+ # License for the dataset if available
72
+ license=_LICENSE,
73
+ )
74
+
75
+ def _split_generators(self, dl_manager):
76
+ """Returns SplitGenerators."""
77
+ # This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
78
+ # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
79
+
80
+ data_dir = os.path.abspath(os.path.expanduser(dl_manager.manual_dir))
81
+
82
+ if not os.path.exists(data_dir):
83
+ raise FileNotFoundError(
84
+ "{} does not exist. Make sure you insert a manual dir via `datasets.load_dataset('jigsaw_toxicity_pred', data_dir=...)`. Manual download instructions: {}".format(
85
+ data_dir, self.manual_download_instructions
86
+ )
87
+ )
88
+
89
+ return [
90
+ datasets.SplitGenerator(
91
+ name=datasets.Split.TRAIN,
92
+ # These kwargs will be passed to _generate_examples
93
+ gen_kwargs={"train_path": os.path.join(data_dir, "train.csv"), "split": "train"},
94
+ ),
95
+ datasets.SplitGenerator(
96
+ name=datasets.Split.TEST,
97
+ # These kwargs will be passed to _generate_examples
98
+ gen_kwargs={
99
+ "test_text_path": os.path.join(data_dir, "test.csv"),
100
+ "test_labels_path": os.path.join(data_dir, "test_labels.csv"),
101
+ "split": "test",
102
+ },
103
+ ),
104
+ ]
105
+
106
+ def _generate_examples(self, split="train", train_path=None, test_text_path=None, test_labels_path=None):
107
+ """ Yields examples. """
108
+ # This method will receive as arguments the `gen_kwargs` defined in the previous `_split_generators` method.
109
+ # It is in charge of opening the given file and yielding (key, example) tuples from the dataset
110
+ # The key is not important, it's more here for legacy reason (legacy from tfds)
111
+
112
+ if split == "test":
113
+ df1 = pd.read_csv(test_text_path)
114
+ df2 = pd.read_csv(test_labels_path)
115
+ df3 = df1.merge(df2)
116
+ df4 = df3[df3["toxic"] != -1]
117
+
118
+ elif split == "train":
119
+ df4 = pd.read_csv(train_path)
120
+
121
+ for _, row in df4.iterrows():
122
+ example = {}
123
+ example["comment_text"] = row["comment_text"]
124
+
125
+ for label in ["toxic", "severe_toxic", "obscene", "threat", "insult", "identity_hate"]:
126
+ if row[label] != -1:
127
+ example[label] = int(row[label])
128
+ yield (row["id"], example)