Update files from the datasets library (from 1.1.3)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.1.3
README.md
CHANGED
@@ -9,7 +9,7 @@ from datasets import load_dataset
|
|
9 |
kilt_wiki = load_dataset("kilt_wikipedia")
|
10 |
|
11 |
# Get the KILT task datasets
|
12 |
-
kilt_tasks =
|
13 |
|
14 |
# Most tasks in KILT already have all required data, but KILT-TriviaQA
|
15 |
# only provides the question IDs, not the questions themselves.
|
@@ -19,7 +19,7 @@ trivia_qa = load_dataset('trivia_qa', 'unfiltered.nocontext')
|
|
19 |
# The KILT IDs can then be mapped to the TriviaQA questions with:
|
20 |
triviaqa_map = {}
|
21 |
for k in ['train', 'validation', 'test']:
|
22 |
-
triviaqa_map = dict([(q_id, i) for i, q_id in enumerate(
|
23 |
kilt_tasks[k + '_triviaqa'] = kilt_tasks[k + '_triviaqa'].filter(lambda x: x['id'] in triviaqa_map)
|
24 |
-
kilt_tasks[k + '_triviaqa'] = kilt_tasks[k + '_triviaqa'].map(lambda x: {'input':
|
25 |
```
|
|
|
9 |
kilt_wiki = load_dataset("kilt_wikipedia")
|
10 |
|
11 |
# Get the KILT task datasets
|
12 |
+
kilt_tasks = load_dataset("kilt_tasks")
|
13 |
|
14 |
# Most tasks in KILT already have all required data, but KILT-TriviaQA
|
15 |
# only provides the question IDs, not the questions themselves.
|
|
|
19 |
# The KILT IDs can then be mapped to the TriviaQA questions with:
|
20 |
triviaqa_map = {}
|
21 |
for k in ['train', 'validation', 'test']:
|
22 |
+
triviaqa_map = dict([(q_id, i) for i, q_id in enumerate(trivia_qa[k]['question_id'])])
|
23 |
kilt_tasks[k + '_triviaqa'] = kilt_tasks[k + '_triviaqa'].filter(lambda x: x['id'] in triviaqa_map)
|
24 |
+
kilt_tasks[k + '_triviaqa'] = kilt_tasks[k + '_triviaqa'].map(lambda x: {'input': trivia_qa[k][triviaqa_map[x['id']]]['question']})
|
25 |
```
|