Datasets:

Modalities:
Text
Formats:
json
Libraries:
Datasets
Dask
License:
jonsaadfalcon commited on
Commit
a23dd78
1 Parent(s): 272191c

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +31 -0
  2. loco_queries.py +104 -0
  3. qmsum_test.jsonl +0 -0
README.md CHANGED
@@ -1,3 +1,34 @@
1
  ---
2
  license: apache-2.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  ---
4
+ # LoCoV1 Queries
5
+
6
+ The queries for the LoCoV1 dataset from the paper, "Benchmarking and Building Long-Context Retrieval Models with LoCo and M2-BERT"
7
+
8
+ ## How to Use
9
+
10
+ To load the dataset, use the following command:
11
+
12
+ ```
13
+ from datasets import load_dataset
14
+ dataset = load_dataset("hazyresearch/LoCoV1-Queries")
15
+ ```
16
+
17
+ To load a specific subset, such as SummScreenFD, use the following command:
18
+
19
+ ```
20
+ from datasets import load_dataset
21
+ dataset = load_dataset("hazyresearch/LoCoV1-Queries")
22
+ def filter_condition(example):
23
+ return example['dataset'] == 'summ_screen_fd'
24
+ filtered_dataset = dataset.filter(filter_condition)
25
+ ```
26
+
27
+ The datasets available are:
28
+ ```
29
+ {'summ_screen_fd', 'gov_report', 'qmsum', 'qasper_title', 'qasper_abstract', '2wikimqa', 'multifieldqa',
30
+ 'passage_retrieval', 'courtlistener_HTML', 'courtlistener_Plain_Text', 'legal_case_reports', 'stackoverflow'}
31
+ ```
32
+
33
+ For documents, go to [hazyresearch/LoCoV1-Documents](https://huggingface.co/datasets/hazyresearch/LoCoV1-Documents).
34
+
loco_queries.py ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ import csv
4
+ import json
5
+ import os
6
+
7
+ import datasets
8
+ import pandas as pd
9
+ import zipfile
10
+
11
+
12
+ _CITATION = """
13
+ """
14
+
15
+ _DESCRIPTION = """\
16
+ LoCoV1 Dataset - Queries
17
+ """
18
+
19
+ _HOMEPAGE = "https://huggingface.co/datasets/hazyresearch/LoCoV1-Queries"
20
+
21
+ _LICENSE = ""
22
+
23
+ _URL = {
24
+ "summ_screen_fd": "https://huggingface.co/datasets/hazyresearch/LoCoV1-Queries/raw/main/queries/summ_screen_fd",
25
+ "gov_report": "https://huggingface.co/datasets/hazyresearch/LoCoV1-Queries/raw/main/queries/gov_report",
26
+ "qmsum": "https://huggingface.co/datasets/hazyresearch/LoCoV1-Queries/raw/main/queries/qmsum",
27
+ "qasper_title": "https://huggingface.co/datasets/hazyresearch/LoCoV1-Queries/raw/main/queries/qasper_title",
28
+ "qasper_abstract": "https://huggingface.co/datasets/hazyresearch/LoCoV1-Queries/raw/main/queries/qasper_abstract",
29
+ "multifieldqa": "https://huggingface.co/datasets/hazyresearch/LoCoV1-Queries/raw/main/queries/multifieldqa",
30
+ "2wikimqa": "https://huggingface.co/datasets/hazyresearch/LoCoV1-Queries/raw/main/queries/2wikimqa",
31
+ "passage_retrieval": "https://huggingface.co/datasets/hazyresearch/LoCoV1-Queries/raw/main/queries/passage_retrieval",
32
+ "courtlistener_HTML": "https://huggingface.co/datasets/hazyresearch/LoCoV1-Queries/raw/main/queries/courtlistener_HTML",
33
+ "courtlistener_Plain_Text": "https://huggingface.co/datasets/hazyresearch/LoCoV1-Queries/raw/main/queries/courtlistener_Plain_Text",
34
+ "legal_case_reports": "https://huggingface.co/datasets/hazyresearch/LoCoV1-Queries/raw/main/queries/legal_case_reports",
35
+ "stackoverflow": "https://huggingface.co/datasets/hazyresearch/LoCoV1-Queries/raw/main/queries/stackoverflow",
36
+ }
37
+
38
+
39
+
40
+
41
+ class NewDataset(datasets.GeneratorBasedBuilder):
42
+
43
+ VERSION = datasets.Version("1.1.0")
44
+
45
+ BUILDER_CONFIGS = [
46
+ datasets.BuilderConfig(name="summ_screen_fd", version=VERSION, description=""),
47
+ datasets.BuilderConfig(name="gov_report", version=VERSION, description=""),
48
+ datasets.BuilderConfig(name="qmsum", version=VERSION, description=""),
49
+ datasets.BuilderConfig(name="qasper_title", version=VERSION, description=""),
50
+ datasets.BuilderConfig(name="qasper_abstract", version=VERSION, description=""),
51
+ datasets.BuilderConfig(name="multifieldqa", version=VERSION, description=""),
52
+ datasets.BuilderConfig(name="2wikimqa", version=VERSION, description=""),
53
+ datasets.BuilderConfig(name="passage_retrieval", version=VERSION, description=""),
54
+ datasets.BuilderConfig(name="courtlistener_HTML", version=VERSION, description=""),
55
+ datasets.BuilderConfig(name="courtlistener_Plain_Text", version=VERSION, description=""),
56
+ datasets.BuilderConfig(name="legal_case_reports", version=VERSION, description=""),
57
+ datasets.BuilderConfig(name="stackoverflow", version=VERSION, description=""),
58
+ ]
59
+
60
+ DEFAULT_CONFIG_NAME = "summ_screen_fd" # It's not mandatory to have a default configuration. Just use one if it make sense.
61
+
62
+ def _info(self):
63
+ features = datasets.Features(
64
+ {
65
+ "qid": datasets.Value("string"),
66
+ "dataset": datasets.Value("string"),
67
+ "query": datasets.Value("string"),
68
+ "answer_pids": datasets.Value("string"),
69
+ }
70
+ )
71
+ return datasets.DatasetInfo(
72
+ description=_DESCRIPTION,
73
+ features=features, # Here we define them above because they are different between the two configurations
74
+ homepage=_HOMEPAGE,
75
+ license=_LICENSE,
76
+ citation=_CITATION,
77
+ )
78
+
79
+ def _split_generators(self, dl_manager):
80
+ _URLS = {
81
+ "test": _URL[self.config.name] + "_test.jsonl",
82
+ }
83
+
84
+ downloaded_files = dl_manager.download_and_extract(_URLS)
85
+
86
+ return [
87
+ datasets.SplitGenerator(name="test", gen_kwargs={"filepath": downloaded_files["test"]}),
88
+ ]
89
+
90
+ # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
91
+ def _generate_examples(self, filepath):
92
+
93
+ with open(filepath, encoding="utf-8") as f:
94
+
95
+ for key, row in enumerate(f):
96
+
97
+ data = json.loads(row)
98
+
99
+ yield key, {
100
+ "qid": data["qid"],
101
+ "dataset": data["dataset"],
102
+ "query": data["query"],
103
+ "answer_pids": data["answer_pids"]
104
+ }
qmsum_test.jsonl ADDED
The diff for this file is too large to render. See raw diff