parquet-converter
commited on
Commit
·
51ac4fa
1
Parent(s):
f425790
Update parquet files
Browse files- .gitignore +0 -1
- create_file.py +0 -11
- data/valid_topic_split.json +0 -3
- data/train.json → random/wow-test.parquet +2 -2
- data/valid_random_split.json → random/wow-train-00000-of-00003.parquet +2 -2
- data/test_random_split.json → random/wow-train-00001-of-00003.parquet +2 -2
- data/test_topic_split.json → random/wow-train-00002-of-00003.parquet +2 -2
- random/wow-validation.parquet +3 -0
- topic/wow-test.parquet +3 -0
- topic/wow-train-00000-of-00003.parquet +3 -0
- topic/wow-train-00001-of-00003.parquet +3 -0
- topic/wow-train-00002-of-00003.parquet +3 -0
- topic/wow-validation.parquet +3 -0
- wow.py +0 -122
.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
original
|
|
|
|
create_file.py
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
|
3 |
-
|
4 |
-
with open("original/train.json") as f:
|
5 |
-
data = json.load(f)
|
6 |
-
|
7 |
-
|
8 |
-
with open("train.json", "w+") as f:
|
9 |
-
for line in data:
|
10 |
-
f.write(json.dumps(line, ensure_ascii=False) + "\n")
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/valid_topic_split.json
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:5d46c5d50b817fceeae394b201540bcf62a24eccd0ca322a96ccb2d3845f526d
|
3 |
-
size 133570056
|
|
|
|
|
|
|
|
data/train.json → random/wow-test.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ef108f10be6fa94bd47710b1842c118b96955321ac1b8debaafd2bbb2e3d9ea3
|
3 |
+
size 7381793
|
data/valid_random_split.json → random/wow-train-00000-of-00003.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:56d15488ad95df6a170d9c75579c7f1ad5e31e9a96f0f35d638cacf4eee40286
|
3 |
+
size 49966808
|
data/test_random_split.json → random/wow-train-00001-of-00003.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:79ace310654a1c090212e581a8b5f6f454440612c6e4385bdd74a1e7645bf865
|
3 |
+
size 50855504
|
data/test_topic_split.json → random/wow-train-00002-of-00003.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9e20d8b59bc938f61b3d7bc265cec637b8bb9ec09666fb43e6443c97713e9498
|
3 |
+
size 37924784
|
random/wow-validation.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1caafa8c684266def706558926139c135151ebf95132e8b3ff732fe6469245ab
|
3 |
+
size 7872918
|
topic/wow-test.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:15f39a00847b2e477c67ba73575265a25f41ba59363472f2faf869d5ae5245cc
|
3 |
+
size 6005755
|
topic/wow-train-00000-of-00003.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:56d15488ad95df6a170d9c75579c7f1ad5e31e9a96f0f35d638cacf4eee40286
|
3 |
+
size 49966808
|
topic/wow-train-00001-of-00003.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:79ace310654a1c090212e581a8b5f6f454440612c6e4385bdd74a1e7645bf865
|
3 |
+
size 50855504
|
topic/wow-train-00002-of-00003.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9e20d8b59bc938f61b3d7bc265cec637b8bb9ec09666fb43e6443c97713e9498
|
3 |
+
size 37924784
|
topic/wow-validation.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:de0b02299c02de72899106952e1d8ce723c85b21fa1c7714d5eb6b14f0d3fd15
|
3 |
+
size 6387158
|
wow.py
DELETED
@@ -1,122 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import json
|
3 |
-
import datasets
|
4 |
-
|
5 |
-
|
6 |
-
_DESCRIPTION = """In open-domain dialogue intelligent agents should exhibit the use of knowledge, however there are few convincing demonstrations of this to date. The most popular sequence to sequence models typically "generate and hope" generic utterances that can be memorized in the weights of the model when mapping from input utterance(s) to output, rather than employing recalled knowledge as context. Use of knowledge has so far proved difficult, in part because of the lack of a supervised learning benchmark task which exhibits knowledgeable open dialogue with clear grounding. To that end we collect and release a large dataset with conversations directly grounded with knowledge retrieved from Wikipedia. We then design architectures capable of retrieving knowledge, reading and conditioning on it, and finally generating natural responses. Our best performing dialogue models are able to conduct knowledgeable discussions on open-domain topics as evaluated by automatic metrics and human evaluations, while our new benchmark allows for measuring further improvements in this important research direction."""
|
7 |
-
_HOMEPAGE = "https://arxiv.org/abs/1811.01241"
|
8 |
-
_CITATION = """@article{dinan2018wizard,
|
9 |
-
title={Wizard of wikipedia: Knowledge-powered conversational agents},
|
10 |
-
author={Dinan, Emily and Roller, Stephen and Shuster, Kurt and Fan, Angela and Auli, Michael and Weston, Jason},
|
11 |
-
journal={arXiv preprint arXiv:1811.01241},
|
12 |
-
year={2018}
|
13 |
-
}"""
|
14 |
-
|
15 |
-
|
16 |
-
class WOWConfig(datasets.BuilderConfig):
|
17 |
-
def __init__(self, *args, split="random", **kwargs):
|
18 |
-
assert split in ["random", "topic"]
|
19 |
-
super().__init__(
|
20 |
-
*args,
|
21 |
-
name=f"{split}",
|
22 |
-
**kwargs,
|
23 |
-
)
|
24 |
-
self.split = split
|
25 |
-
|
26 |
-
|
27 |
-
class WOW(datasets.GeneratorBasedBuilder):
|
28 |
-
|
29 |
-
BUILDER_CONFIGS = [WOWConfig(split="random"), WOWConfig(split="topic")]
|
30 |
-
BUILDER_CONFIG_CLASS = WOWConfig
|
31 |
-
|
32 |
-
def _info(self):
|
33 |
-
features = {
|
34 |
-
"chosen_topic": datasets.Value("string"),
|
35 |
-
"persona": datasets.Value("string"),
|
36 |
-
"wizard_eval": datasets.Value("int32"),
|
37 |
-
"dialog": [{
|
38 |
-
"speaker": datasets.Value("string"),
|
39 |
-
"text": datasets.Value("string"),
|
40 |
-
"checked_sentence_value": datasets.Value("string"),
|
41 |
-
"checked_sentence_key": datasets.Value("string"),
|
42 |
-
"checked_passage_value": datasets.Value("string"),
|
43 |
-
"checked_passage_key": datasets.Value("string"),
|
44 |
-
"retrieved_passages": [{
|
45 |
-
"key": datasets.Value("string"),
|
46 |
-
"values": [datasets.Value("string")]
|
47 |
-
}],
|
48 |
-
"retrieved_topics": [datasets.Value("string")]
|
49 |
-
}]
|
50 |
-
}
|
51 |
-
return datasets.DatasetInfo(
|
52 |
-
description=_DESCRIPTION,
|
53 |
-
features=datasets.Features(features),
|
54 |
-
supervised_keys=None,
|
55 |
-
homepage=_HOMEPAGE,
|
56 |
-
citation=_CITATION,
|
57 |
-
)
|
58 |
-
|
59 |
-
def _split_generators(self, dl_manager):
|
60 |
-
train_filename = dl_manager.download_and_extract("data/train.json")
|
61 |
-
valid_filename = dl_manager.download_and_extract(f"data/valid_{self.config.split}_split.json")
|
62 |
-
test_filename = dl_manager.download_and_extract(f"data/test_{self.config.split}_split.json")
|
63 |
-
return [
|
64 |
-
datasets.SplitGenerator(
|
65 |
-
name=datasets.Split.TRAIN,
|
66 |
-
gen_kwargs={"filename": train_filename},
|
67 |
-
),
|
68 |
-
datasets.SplitGenerator(
|
69 |
-
name=datasets.Split.VALIDATION,
|
70 |
-
gen_kwargs={"filename": valid_filename},
|
71 |
-
),
|
72 |
-
datasets.SplitGenerator(
|
73 |
-
name=datasets.Split.TEST,
|
74 |
-
gen_kwargs={"filename": test_filename},
|
75 |
-
)
|
76 |
-
]
|
77 |
-
|
78 |
-
def _generate_examples(self, filename):
|
79 |
-
with open(filename) as f:
|
80 |
-
for i, line in enumerate(f):
|
81 |
-
line = json.loads(line)
|
82 |
-
history = []
|
83 |
-
for j, turn in enumerate(line["dialog"]):
|
84 |
-
retrieved_passages = []
|
85 |
-
for passage in turn["retrieved_passages"]:
|
86 |
-
key = list(passage.keys())[0]
|
87 |
-
values = list(passage.values())[0]
|
88 |
-
retrieved_passages.append({
|
89 |
-
"key": key,
|
90 |
-
"values": values
|
91 |
-
})
|
92 |
-
if turn["speaker"] == "0_Wizard":
|
93 |
-
checked_sentence = list(turn.get("checked_sentence", {}).items())
|
94 |
-
checked_passage = list(turn.get("checked_passage", {}).items())
|
95 |
-
history.append({
|
96 |
-
"speaker": turn["speaker"],
|
97 |
-
"text": turn["text"],
|
98 |
-
"checked_sentence_key": "" if len(checked_sentence) == 0 else checked_sentence[0][0],
|
99 |
-
"checked_sentence_value": "" if len(checked_sentence) == 0 else checked_sentence[0][1],
|
100 |
-
"checked_passage_key": "" if len(checked_passage) == 0 else checked_passage[0][0],
|
101 |
-
"checked_passage_value": "" if len(checked_passage) == 0 else checked_passage[0][1],
|
102 |
-
"retrieved_passages": retrieved_passages,
|
103 |
-
"retrieved_topics": line["retrieved_topics"] if "retrieved_topics" in line else []
|
104 |
-
})
|
105 |
-
else:
|
106 |
-
history.append({
|
107 |
-
"speaker": turn["speaker"],
|
108 |
-
"text": turn["text"],
|
109 |
-
"checked_sentence_key": "",
|
110 |
-
"checked_sentence_value": "",
|
111 |
-
"checked_passage_key": "",
|
112 |
-
"checked_passage_value": "",
|
113 |
-
"retrieved_passages": [],
|
114 |
-
"retrieved_topics": []
|
115 |
-
})
|
116 |
-
yield f"{i}_{j}", {
|
117 |
-
"chosen_topic": line["chosen_topic"],
|
118 |
-
"persona": line["persona"],
|
119 |
-
"wizard_eval": line["wizard_eval"],
|
120 |
-
"dialog": history
|
121 |
-
}
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|