Datasets:

Languages:
English
ArXiv:
License:
rishabbala commited on
Commit
91cc602
1 Parent(s): f47c062

Delete loading script

Browse files
Files changed (1) hide show
  1. cosmos_qa.py +0 -116
cosmos_qa.py DELETED
@@ -1,116 +0,0 @@
1
- """Cosmos QA dataset."""
2
-
3
-
4
- import csv
5
- import json
6
-
7
- import datasets
8
-
9
-
10
- _HOMEPAGE = "https://wilburone.github.io/cosmos/"
11
-
12
- _DESCRIPTION = """\
13
- Cosmos QA is a large-scale dataset of 35.6K problems that require commonsense-based reading comprehension, formulated as multiple-choice questions. It focuses on reading between the lines over a diverse collection of people's everyday narratives, asking questions concerning on the likely causes or effects of events that require reasoning beyond the exact text spans in the context
14
- """
15
-
16
- _CITATION = """\
17
- @inproceedings{huang-etal-2019-cosmos,
18
- title = "Cosmos {QA}: Machine Reading Comprehension with Contextual Commonsense Reasoning",
19
- author = "Huang, Lifu and
20
- Le Bras, Ronan and
21
- Bhagavatula, Chandra and
22
- Choi, Yejin",
23
- booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)",
24
- month = nov,
25
- year = "2019",
26
- address = "Hong Kong, China",
27
- publisher = "Association for Computational Linguistics",
28
- url = "https://www.aclweb.org/anthology/D19-1243",
29
- doi = "10.18653/v1/D19-1243",
30
- pages = "2391--2401",
31
- }
32
- """
33
-
34
- _LICENSE = "CC BY 4.0"
35
-
36
- _URL = "https://github.com/wilburOne/cosmosqa/raw/master/data/"
37
- _URLS = {
38
- "train": _URL + "train.csv",
39
- "test": _URL + "test.jsonl",
40
- "dev": _URL + "valid.csv",
41
- }
42
-
43
-
44
- class CosmosQa(datasets.GeneratorBasedBuilder):
45
- """Cosmos QA dataset."""
46
-
47
- VERSION = datasets.Version("0.1.0")
48
-
49
- def _info(self):
50
- return datasets.DatasetInfo(
51
- description=_DESCRIPTION,
52
- features=datasets.Features(
53
- {
54
- "id": datasets.Value("string"),
55
- "context": datasets.Value("string"),
56
- "question": datasets.Value("string"),
57
- "answer0": datasets.Value("string"),
58
- "answer1": datasets.Value("string"),
59
- "answer2": datasets.Value("string"),
60
- "answer3": datasets.Value("string"),
61
- "label": datasets.Value("int32"),
62
- }
63
- ),
64
- homepage=_HOMEPAGE,
65
- citation=_CITATION,
66
- license=_LICENSE,
67
- )
68
-
69
- def _split_generators(self, dl_manager):
70
- """Returns SplitGenerators."""
71
- urls_to_download = _URLS
72
- dl_dir = dl_manager.download_and_extract(urls_to_download)
73
- return [
74
- datasets.SplitGenerator(
75
- name=datasets.Split.TRAIN,
76
- gen_kwargs={"filepath": dl_dir["train"], "split": "train"},
77
- ),
78
- datasets.SplitGenerator(
79
- name=datasets.Split.TEST,
80
- gen_kwargs={"filepath": dl_dir["test"], "split": "test"},
81
- ),
82
- datasets.SplitGenerator(
83
- name=datasets.Split.VALIDATION,
84
- gen_kwargs={"filepath": dl_dir["dev"], "split": "dev"},
85
- ),
86
- ]
87
-
88
- def _generate_examples(self, filepath, split):
89
- """Yields examples."""
90
- with open(filepath, encoding="utf-8") as f:
91
- if split == "test":
92
- for id_, row in enumerate(f):
93
- data = json.loads(row)
94
- yield id_, {
95
- "id": data["id"],
96
- "context": data["context"],
97
- "question": data["question"],
98
- "answer0": data["answer0"],
99
- "answer1": data["answer1"],
100
- "answer2": data["answer2"],
101
- "answer3": data["answer3"],
102
- "label": int(data.get("label", -1)),
103
- }
104
- else:
105
- data = csv.DictReader(f)
106
- for id_, row in enumerate(data):
107
- yield id_, {
108
- "id": row["id"],
109
- "context": row["context"],
110
- "question": row["question"],
111
- "answer0": row["answer0"],
112
- "answer1": row["answer1"],
113
- "answer2": row["answer2"],
114
- "answer3": row["answer3"],
115
- "label": int(row.get("label", -1)),
116
- }