SamAdamDay commited on
Commit
bb05a2f
1 Parent(s): 32a38db

Update wiki_toxic.py

Browse files
Files changed (1) hide show
  1. wiki_toxic.py +11 -2
wiki_toxic.py CHANGED
@@ -60,12 +60,18 @@ class WikiToxic(datasets.GeneratorBasedBuilder):
60
  )
61
 
62
  def _split_generators(self, dl_manager):
63
- # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
64
- # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
 
 
 
 
 
65
 
66
  return [
67
  datasets.SplitGenerator(
68
  name=datasets.Split.TRAIN,
 
69
  # These kwargs will be passed to _generate_examples
70
  gen_kwargs={
71
  "filepath": "train.csv",
@@ -74,6 +80,7 @@ class WikiToxic(datasets.GeneratorBasedBuilder):
74
  ),
75
  datasets.SplitGenerator(
76
  name=datasets.Split.VALIDATION,
 
77
  # These kwargs will be passed to _generate_examples
78
  gen_kwargs={
79
  "filepath": "validation.csv",
@@ -82,6 +89,7 @@ class WikiToxic(datasets.GeneratorBasedBuilder):
82
  ),
83
  datasets.SplitGenerator(
84
  name=datasets.Split.TEST,
 
85
  # These kwargs will be passed to _generate_examples
86
  gen_kwargs={
87
  "filepath": "test.csv",
@@ -90,6 +98,7 @@ class WikiToxic(datasets.GeneratorBasedBuilder):
90
  ),
91
  datasets.SplitGenerator(
92
  name="balanced_train",
 
93
  # These kwargs will be passed to _generate_examples
94
  gen_kwargs={
95
  "filepath": "balanced_train.csv",
 
60
  )
61
 
62
  def _split_generators(self, dl_manager):
63
+ features = datasets.Features(
64
+ {
65
+ "id": datasets.Value("string"),
66
+ "comment_text": datasets.Value("string"),
67
+ "label": datasets.ClassLabel(names=["non", "tox"])
68
+ }
69
+ )
70
 
71
  return [
72
  datasets.SplitGenerator(
73
  name=datasets.Split.TRAIN,
74
+ features=features,
75
  # These kwargs will be passed to _generate_examples
76
  gen_kwargs={
77
  "filepath": "train.csv",
 
80
  ),
81
  datasets.SplitGenerator(
82
  name=datasets.Split.VALIDATION,
83
+ features=features,
84
  # These kwargs will be passed to _generate_examples
85
  gen_kwargs={
86
  "filepath": "validation.csv",
 
89
  ),
90
  datasets.SplitGenerator(
91
  name=datasets.Split.TEST,
92
+ features=features,
93
  # These kwargs will be passed to _generate_examples
94
  gen_kwargs={
95
  "filepath": "test.csv",
 
98
  ),
99
  datasets.SplitGenerator(
100
  name="balanced_train",
101
+ features=features,
102
  # These kwargs will be passed to _generate_examples
103
  gen_kwargs={
104
  "filepath": "balanced_train.csv",