albertvillanova HF staff commited on
Commit
9d57a64
1 Parent(s): fa77a3e

Delete loading script

Browse files
Files changed (1) hide show
  1. art.py +0 -116
art.py DELETED
@@ -1,116 +0,0 @@
1
- """TODO(art): Add a description here."""
2
-
3
-
4
- import json
5
- import os
6
-
7
- import datasets
8
-
9
-
10
- # TODO(art): BibTeX citation
11
- _CITATION = """\
12
- @InProceedings{anli,
13
- author = {Chandra, Bhagavatula and Ronan, Le Bras and Chaitanya, Malaviya and Keisuke, Sakaguchi and Ari, Holtzman
14
- and Hannah, Rashkin and Doug, Downey and Scott, Wen-tau Yih and Yejin, Choi},
15
- title = {Abductive Commonsense Reasoning},
16
- year = {2020}
17
- }"""
18
-
19
- # TODO(art):
20
- _DESCRIPTION = """\
21
- the Abductive Natural Language Inference Dataset from AI2
22
- """
23
- _DATA_URL = "https://storage.googleapis.com/ai2-mosaic/public/alphanli/alphanli-train-dev.zip"
24
-
25
-
26
- class ArtConfig(datasets.BuilderConfig):
27
- """BuilderConfig for Art."""
28
-
29
- def __init__(self, **kwargs):
30
- """BuilderConfig for Art.
31
- Args:
32
- **kwargs: keyword arguments forwarded to super.
33
- """
34
- super(ArtConfig, self).__init__(version=datasets.Version("0.1.0", ""), **kwargs)
35
-
36
-
37
- class Art(datasets.GeneratorBasedBuilder):
38
- """TODO(art): Short description of my dataset."""
39
-
40
- # TODO(art): Set up version.
41
- VERSION = datasets.Version("0.1.0")
42
- BUILDER_CONFIGS = [
43
- ArtConfig(
44
- name="anli",
45
- description="""\
46
- the Abductive Natural Language Inference Dataset from AI2.
47
- """,
48
- ),
49
- ]
50
-
51
- def _info(self):
52
- # TODO(art): Specifies the datasets.DatasetInfo object
53
- return datasets.DatasetInfo(
54
- # This is the description that will appear on the datasets page.
55
- description=_DESCRIPTION,
56
- # datasets.features.FeatureConnectors
57
- features=datasets.Features(
58
- {
59
- "observation_1": datasets.Value("string"),
60
- "observation_2": datasets.Value("string"),
61
- "hypothesis_1": datasets.Value("string"),
62
- "hypothesis_2": datasets.Value("string"),
63
- "label": datasets.features.ClassLabel(num_classes=3)
64
- # These are the features of your dataset like images, labels ...
65
- }
66
- ),
67
- # If there's a common (input, target) tuple from the features,
68
- # specify them here. They'll be used if as_supervised=True in
69
- # builder.as_dataset.
70
- supervised_keys=None,
71
- # Homepage of the dataset for documentation
72
- homepage="https://leaderboard.allenai.org/anli/submissions/get-started",
73
- citation=_CITATION,
74
- )
75
-
76
- def _split_generators(self, dl_manager):
77
- """Returns SplitGenerators."""
78
- # TODO(art): Downloads the data and defines the splits
79
- # dl_manager is a datasets.download.DownloadManager that can be used to
80
- # download and extract URLs
81
- dl_dir = dl_manager.download_and_extract(_DATA_URL)
82
- return [
83
- datasets.SplitGenerator(
84
- name=datasets.Split.VALIDATION,
85
- gen_kwargs={
86
- "filepath": os.path.join(dl_dir, "dev.jsonl"),
87
- "labelpath": os.path.join(dl_dir, "dev-labels.lst"),
88
- },
89
- ),
90
- datasets.SplitGenerator(
91
- name=datasets.Split.TRAIN,
92
- gen_kwargs={
93
- "filepath": os.path.join(dl_dir, "train.jsonl"),
94
- "labelpath": os.path.join(dl_dir, "train-labels.lst"),
95
- },
96
- ),
97
- ]
98
-
99
- def _generate_examples(self, filepath, labelpath):
100
- """Yields examples."""
101
- # TODO(art): Yields (key, example) tuples from the dataset
102
- data = []
103
- for line in open(filepath, encoding="utf-8"):
104
- data.append(json.loads(line))
105
- labels = []
106
- with open(labelpath, encoding="utf-8") as f:
107
- for word in f:
108
- labels.append(word)
109
- for idx, row in enumerate(data):
110
- yield idx, {
111
- "observation_1": row["obs1"],
112
- "observation_2": row["obs2"],
113
- "hypothesis_1": row["hyp1"],
114
- "hypothesis_2": row["hyp2"],
115
- "label": labels[idx],
116
- }