rishabbala commited on
Commit
92033e8
1 Parent(s): 6db3dce

Delete loading script

Browse files
Files changed (1) hide show
  1. social_i_qa.py +0 -100
social_i_qa.py DELETED
@@ -1,100 +0,0 @@
1
- """TODO(social_i_qa): Add a description here."""
2
-
3
-
4
- import json
5
- import os
6
-
7
- import datasets
8
-
9
-
10
- # TODO(social_i_qa): BibTeX citation
11
- _CITATION = """
12
- """
13
-
14
- # TODO(social_i_qa):
15
- _DESCRIPTION = """\
16
- We introduce Social IQa: Social Interaction QA, a new question-answering benchmark for testing social commonsense intelligence. Contrary to many prior benchmarks that focus on physical or taxonomic knowledge, Social IQa focuses on reasoning about people’s actions and their social implications. For example, given an action like "Jesse saw a concert" and a question like "Why did Jesse do this?", humans can easily infer that Jesse wanted "to see their favorite performer" or "to enjoy the music", and not "to see what's happening inside" or "to see if it works". The actions in Social IQa span a wide variety of social situations, and answer candidates contain both human-curated answers and adversarially-filtered machine-generated candidates. Social IQa contains over 37,000 QA pairs for evaluating models’ abilities to reason about the social implications of everyday events and situations. (Less)
17
- """
18
- _URL = "https://storage.googleapis.com/ai2-mosaic/public/socialiqa/socialiqa-train-dev.zip"
19
-
20
-
21
- class SocialIQa(datasets.GeneratorBasedBuilder):
22
- """TODO(social_i_qa): Short description of my dataset."""
23
-
24
- # TODO(social_i_qa): Set up version.
25
- VERSION = datasets.Version("0.1.0")
26
-
27
- def _info(self):
28
- # TODO(social_i_qa): Specifies the datasets.DatasetInfo object
29
- return datasets.DatasetInfo(
30
- # This is the description that will appear on the datasets page.
31
- description=_DESCRIPTION,
32
- # datasets.features.FeatureConnectors
33
- features=datasets.Features(
34
- {
35
- # These are the features of your dataset like images, labels ...
36
- "context": datasets.Value("string"),
37
- "question": datasets.Value("string"),
38
- "answerA": datasets.Value("string"),
39
- "answerB": datasets.Value("string"),
40
- "answerC": datasets.Value("string"),
41
- "label": datasets.Value("string"),
42
- }
43
- ),
44
- # If there's a common (input, target) tuple from the features,
45
- # specify them here. They'll be used if as_supervised=True in
46
- # builder.as_dataset.
47
- supervised_keys=None,
48
- # Homepage of the dataset for documentation
49
- homepage="https://leaderboard.allenai.org/socialiqa/submissions/get-started",
50
- citation=_CITATION,
51
- )
52
-
53
- def _split_generators(self, dl_manager):
54
- """Returns SplitGenerators."""
55
- # TODO(social_i_qa): Downloads the data and defines the splits
56
- # dl_manager is a datasets.download.DownloadManager that can be used to
57
- # download and extract URLs
58
- dl_dir = dl_manager.download_and_extract(_URL)
59
- dl_dir = os.path.join(dl_dir, "socialiqa-train-dev")
60
- return [
61
- datasets.SplitGenerator(
62
- name=datasets.Split.TRAIN,
63
- # These kwargs will be passed to _generate_examples
64
- gen_kwargs={
65
- "filepath": os.path.join(dl_dir, "train.jsonl"),
66
- "labelpath": os.path.join(dl_dir, "train-labels.lst"),
67
- },
68
- ),
69
- datasets.SplitGenerator(
70
- name=datasets.Split.VALIDATION,
71
- # These kwargs will be passed to _generate_examples
72
- gen_kwargs={
73
- "filepath": os.path.join(dl_dir, "dev.jsonl"),
74
- "labelpath": os.path.join(dl_dir, "dev-labels.lst"),
75
- },
76
- ),
77
- ]
78
-
79
- def _generate_examples(self, filepath, labelpath):
80
- """Yields examples."""
81
- # TODO(social_i_qa): Yields (key, example) tuples from the dataset
82
- with open(labelpath, encoding="utf-8") as f:
83
- labels = [label.strip() for label in f]
84
- with open(filepath, encoding="utf-8") as f1:
85
- for id_, row in enumerate(f1):
86
- data = json.loads(row)
87
- label = labels[id_]
88
- context = data["context"]
89
- answerA = data["answerA"]
90
- answerB = data["answerB"]
91
- answerC = data["answerC"]
92
- question = data["question"]
93
- yield id_, {
94
- "context": context,
95
- "question": question,
96
- "answerA": answerA,
97
- "answerB": answerB,
98
- "answerC": answerC,
99
- "label": label,
100
- }