system HF staff commited on
Commit
d0c6d32
0 Parent(s):

Update files from the datasets library (from 1.2.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.2.0

.gitattributes ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ language_creators:
5
+ - crowdsourced
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - unknown
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - n<1K
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - sequence-modeling
18
+ task_ids:
19
+ - dialogue-modeling
20
+ ---
21
+
22
+ # Dataset Card Creation Guide
23
+
24
+ ## Table of Contents
25
+ - [Dataset Description](#dataset-description)
26
+ - [Dataset Summary](#dataset-summary)
27
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
28
+ - [Languages](#languages)
29
+ - [Dataset Structure](#dataset-structure)
30
+ - [Data Instances](#data-instances)
31
+ - [Data Fields](#data-instances)
32
+ - [Data Splits](#data-instances)
33
+ - [Dataset Creation](#dataset-creation)
34
+ - [Curation Rationale](#curation-rationale)
35
+ - [Source Data](#source-data)
36
+ - [Annotations](#annotations)
37
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
38
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
39
+ - [Social Impact of Dataset](#social-impact-of-dataset)
40
+ - [Discussion of Biases](#discussion-of-biases)
41
+ - [Other Known Limitations](#other-known-limitations)
42
+ - [Additional Information](#additional-information)
43
+ - [Dataset Curators](#dataset-curators)
44
+ - [Licensing Information](#licensing-information)
45
+ - [Citation Information](#citation-information)
46
+
47
+ ## Dataset Description
48
+
49
+ - **Homepage:** [COCOA](https://stanfordnlp.github.io/cocoa/)
50
+ - **Repository:** [Github repository](https://github.com/stanfordnlp/cocoa)
51
+ - **Paper:** [Learning Symmetric Collaborative Dialogue Agents with Dynamic Knowledge Graph Embeddings (ACL 2017)](https://arxiv.org/abs/1704.07130)
52
+ - **Codalab**: [Codalab](https://worksheets.codalab.org/worksheets/0xc757f29f5c794e5eb7bfa8ca9c945573/)
53
+
54
+ ### Dataset Summary
55
+
56
+ Our goal is to build systems that collaborate with people by exchanging information through natural language and reasoning over structured knowledge base. In the MutualFriend task, two agents, A and B, each have a private knowledge base, which contains a list of friends with multiple attributes (e.g., name, school, major, etc.). The agents must chat with each other to find their unique mutual friend.
57
+
58
+ ### Supported Tasks and Leaderboards
59
+
60
+ We consider two agents, each with a private knowledge base of items, who must communicate their knowlege to achieve a common goal. Specifically, we designed the MutualFriends task (see the figure below). Each agent has a list of friends with attributes like school, major etc. They must chat with each other to find the unique mutual friend.
61
+
62
+ ### Languages
63
+
64
+ The text in the dataset is in English. The associated BCP-47 code is `en`.
65
+
66
+ ## Dataset Structure
67
+
68
+ ### Data Instances
69
+
70
+ An example looks like this.
71
+
72
+ ```
73
+ {
74
+ 'uuid': 'C_423324a5fff045d78bef75a6f295a3f4'
75
+
76
+ 'scenario_uuid': 'S_hvmRM4YNJd55ecT5',
77
+ 'scenario_alphas': [0.30000001192092896, 1.0, 1.0],
78
+ 'scenario_attributes': {
79
+ 'name': ['School', 'Company', 'Location Preference'],
80
+ 'unique': [False, False, False],
81
+ 'value_type': ['school', 'company', 'loc_pref']
82
+ },
83
+ 'scenario_kbs': [
84
+ [
85
+ [['School', 'Company', 'Location Preference'], ['Longwood College', 'Alton Steel', 'indoor']],
86
+ [['School', 'Company', 'Location Preference'], ['Salisbury State University', 'Leonard Green & Partners', 'indoor']],
87
+ [['School', 'Company', 'Location Preference'], ['New Mexico Highlands University', 'Crazy Eddie', 'indoor']],
88
+ [['School', 'Company', 'Location Preference'], ['Rhodes College', "Tully's Coffee", 'indoor']],
89
+ [['School', 'Company', 'Location Preference'], ['Sacred Heart University', 'AMR Corporation', 'indoor']],
90
+ [['School', 'Company', 'Location Preference'], ['Salisbury State University', 'Molycorp', 'indoor']],
91
+ [['School', 'Company', 'Location Preference'], ['New Mexico Highlands University', 'The Hartford Financial Services Group', 'indoor']],
92
+ [['School', 'Company', 'Location Preference'], ['Sacred Heart University', 'Molycorp', 'indoor']],
93
+ [['School', 'Company', 'Location Preference'], ['Babson College', 'The Hartford Financial Services Group', 'indoor']]
94
+ ],
95
+ [
96
+ [['School', 'Company', 'Location Preference'], ['National Technological University', 'Molycorp', 'indoor']],
97
+ [['School', 'Company', 'Location Preference'], ['Fairmont State College', 'Leonard Green & Partners', 'outdoor']],
98
+ [['School', 'Company', 'Location Preference'], ['Johnson C. Smith University', 'Data Resources Inc.', 'outdoor']],
99
+ [['School', 'Company', 'Location Preference'], ['Salisbury State University', 'Molycorp', 'indoor']],
100
+ [['School', 'Company', 'Location Preference'], ['Fairmont State College', 'Molycorp', 'outdoor']],
101
+ [['School', 'Company', 'Location Preference'], ['University of South Carolina - Aiken', 'Molycorp', 'indoor']],
102
+ [['School', 'Company', 'Location Preference'], ['University of South Carolina - Aiken', 'STX', 'outdoor']],
103
+ [['School', 'Company', 'Location Preference'], ['National Technological University', 'STX', 'outdoor']],
104
+ [['School', 'Company', 'Location Preference'], ['Johnson C. Smith University', 'Rockstar Games', 'indoor']]
105
+ ]
106
+ ],
107
+
108
+ 'agents': {
109
+ '0': 'human',
110
+ '1': 'human'
111
+ },
112
+
113
+ 'outcome_reward': 1,
114
+
115
+ 'events': {
116
+ 'actions': ['message', 'message', 'message', 'message', 'select', 'select'],
117
+ 'agents': [1, 1, 0, 0, 1, 0],
118
+ 'data_messages': ['Hello', 'Do you know anyone who works at Molycorp?', 'Hi. All of my friends like the indoors.', 'Ihave two friends that work at Molycorp. They went to Salisbury and Sacred Heart.', '', ''],
119
+ 'data_selects': {
120
+ 'attributes': [
121
+ [], [], [], [], ['School', 'Company', 'Location Preference'], ['School', 'Company', 'Location Preference']
122
+ ],
123
+ 'values': [
124
+ [], [], [], [], ['Salisbury State University', 'Molycorp', 'indoor'], ['Salisbury State University', 'Molycorp', 'indoor']
125
+ ]
126
+ },
127
+ 'start_times': [-1.0, -1.0, -1.0, -1.0, -1.0, -1.0],
128
+ 'times': [1480737280.0, 1480737280.0, 1480737280.0, 1480737280.0, 1480737280.0, 1480737280.0]
129
+ },
130
+ }
131
+ ```
132
+
133
+ ### Data Fields
134
+
135
+ - `uuid`: example id.
136
+ - `scenario_uuid`: scenario id.
137
+ - `scenario_alphas`: scenario alphas.
138
+ - `scenario_attributes`: all the attributes considered in the scenario. The dictionaries are liniearized: to reconstruct the dictionary of attribute i-th, one should extract the i-th elements of `unique`, `value_type` and `name`.
139
+ - `unique`: bool.
140
+ - `value_type`: code/type of the attribute.
141
+ - `name`: name of the attribute.
142
+ - `scenario_kbs`: descriptions of the persons present in the two users' databases. List of two (one for each user in the dialogue). `scenario_kbs[i]` is a list of persons. Each person is represented as two lists (one for attribute names and the other for attribute values). The j-th element of attribute names corresponds to the j-th element of attribute values (linearized dictionary).
143
+ - `agents`: the two users engaged in the dialogue.
144
+ - `outcome_reward`: reward of the present dialogue.
145
+ - `events`: dictionary describing the dialogue. The j-th element of each sub-element of the dictionary describes the turn along the axis of the sub-element.
146
+ - `actions`: type of turn (either `message` or `select`).
147
+ - `agents`: who is talking? Agent 1 or 0?
148
+ - `data_messages`: the string exchanged if `action==message`. Otherwise, empty string.
149
+ - `data_selects`: selection of the user if `action==select`. Otherwise, empty selection/dictionary.
150
+ - `start_times`: always -1 in these data.
151
+ - `times`: sending time.
152
+
153
+ ### Data Splits
154
+
155
+ There are 8967 dialogues for training, 1083 for validation and 1107 for testing.
156
+
157
+ ## Dataset Creation
158
+
159
+ ### Curation Rationale
160
+
161
+ [More Information Needed]
162
+
163
+ ### Source Data
164
+
165
+ [More Information Needed]
166
+
167
+ #### Initial Data Collection and Normalization
168
+
169
+ [More Information Needed]
170
+
171
+ #### Who are the source language producers?
172
+
173
+ [More Information Needed]
174
+
175
+ ### Annotations
176
+
177
+ [More Information Needed]
178
+
179
+ #### Annotation process
180
+
181
+ [More Information Needed]
182
+
183
+ #### Who are the annotators?
184
+
185
+ [More Information Needed]
186
+
187
+ ### Personal and Sensitive Information
188
+
189
+ [More Information Needed]
190
+
191
+ ## Considerations for Using the Data
192
+
193
+ ### Social Impact of Dataset
194
+
195
+ [More Information Needed]
196
+
197
+ ### Discussion of Biases
198
+
199
+ [More Information Needed]
200
+
201
+ ### Other Known Limitations
202
+
203
+ [More Information Needed]
204
+
205
+ ## Additional Information
206
+
207
+ ### Dataset Curators
208
+
209
+ [More Information Needed]
210
+
211
+ ### Licensing Information
212
+
213
+ [More Information Needed]
214
+
215
+ ### Citation Information
216
+
217
+ ```
218
+ @inproceedings{he-etal-2017-learning,
219
+ title = "Learning Symmetric Collaborative Dialogue Agents with Dynamic Knowledge Graph Embeddings",
220
+ author = "He, He and
221
+ Balakrishnan, Anusha and
222
+ Eric, Mihail and
223
+ Liang, Percy",
224
+ booktitle = "Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
225
+ month = jul,
226
+ year = "2017",
227
+ address = "Vancouver, Canada",
228
+ publisher = "Association for Computational Linguistics",
229
+ url = "https://www.aclweb.org/anthology/P17-1162",
230
+ doi = "10.18653/v1/P17-1162",
231
+ pages = "1766--1776",
232
+ abstract = "We study a \textit{symmetric collaborative dialogue} setting in which two agents, each with private knowledge, must strategically communicate to achieve a common goal. The open-ended dialogue state in this setting poses new challenges for existing dialogue systems. We collected a dataset of 11K human-human dialogues, which exhibits interesting lexical, semantic, and strategic elements. To model both structured knowledge and unstructured language, we propose a neural model with dynamic knowledge graph embeddings that evolve as the dialogue progresses. Automatic and human evaluations show that our model is both more effective at achieving the goal and more human-like than baseline neural and rule-based models.",
233
+ }
234
+ ```
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"plain_text": {"description": "Our goal is to build systems that collaborate with people by exchanging\ninformation through natural language and reasoning over structured knowledge\nbase. In the MutualFriend task, two agents, A and B, each have a private\nknowledge base, which contains a list of friends with multiple attributes\n(e.g., name, school, major, etc.). The agents must chat with each other\nto find their unique mutual friend.", "citation": "@inproceedings{he-etal-2017-learning,\n title = \"Learning Symmetric Collaborative Dialogue Agents with Dynamic Knowledge Graph Embeddings\",\n author = \"He, He and\n Balakrishnan, Anusha and\n Eric, Mihail and\n Liang, Percy\",\n booktitle = \"Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)\",\n month = jul,\n year = \"2017\",\n address = \"Vancouver, Canada\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/P17-1162\",\n doi = \"10.18653/v1/P17-1162\",\n pages = \"1766--1776\",\n abstract = \"We study a \textit{symmetric collaborative dialogue} setting in which two agents, each with private knowledge, must strategically communicate to achieve a common goal. The open-ended dialogue state in this setting poses new challenges for existing dialogue systems. We collected a dataset of 11K human-human dialogues, which exhibits interesting lexical, semantic, and strategic elements. To model both structured knowledge and unstructured language, we propose a neural model with dynamic knowledge graph embeddings that evolve as the dialogue progresses. Automatic and human evaluations show that our model is both more effective at achieving the goal and more human-like than baseline neural and rule-based models.\",\n}\n", "homepage": "https://stanfordnlp.github.io/cocoa/", "license": "Unknown", "features": {"uuid": {"dtype": "string", "id": null, "_type": "Value"}, "scenario_uuid": {"dtype": "string", "id": null, "_type": "Value"}, "scenario_alphas": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "scenario_attributes": {"feature": {"unique": {"dtype": "bool_", "id": null, "_type": "Value"}, "value_type": {"dtype": "string", "id": null, "_type": "Value"}, "name": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "scenario_kbs": {"feature": {"feature": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "agents": {"1": {"dtype": "string", "id": null, "_type": "Value"}, "0": {"dtype": "string", "id": null, "_type": "Value"}}, "outcome_reward": {"dtype": "int32", "id": null, "_type": "Value"}, "events": {"actions": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "start_times": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "data_messages": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "data_selects": {"feature": {"attributes": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "values": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}, "agents": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "times": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}}, "post_processed": null, "supervised_keys": null, "builder_name": "mutual_friends", "config_name": "plain_text", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 26979472, "num_examples": 8967, "dataset_name": "mutual_friends"}, "test": {"name": "test", "num_bytes": 3327158, "num_examples": 1107, "dataset_name": "mutual_friends"}, "validation": {"name": "validation", "num_bytes": 3267881, "num_examples": 1083, "dataset_name": "mutual_friends"}}, "download_checksums": {"https://worksheets.codalab.org/rest/bundles/0x09c73c9db1134621bcc827689c6c3c61/contents/blob/train.json": {"num_bytes": 33178253, "checksum": "578399bf9339851628bf8b0d96df5386805d87fe9c801c424cd8bd3d476c63e3"}, "https://worksheets.codalab.org/rest/bundles/0x09c73c9db1134621bcc827689c6c3c61/contents/blob/dev.json": {"num_bytes": 4001596, "checksum": "37af10108b353b5508747009a3ecb6bd5203ce66f9d9599b4322b248853aabf7"}, "https://worksheets.codalab.org/rest/bundles/0x09c73c9db1134621bcc827689c6c3c61/contents/blob/test.json": {"num_bytes": 4094729, "checksum": "f8c1117fe9b024554d517da2101d978196d7e28c85ef6683881a39e2e5eb6e3b"}}, "download_size": 41274578, "post_processing_size": null, "dataset_size": 33574511, "size_in_bytes": 74849089}}
dummy/plain_text/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:67a51999bffd79d13077e3a79cf5694f43174aa9a67358a62f59b8ad5d780f42
3
+ size 8468
mutual_friends.py ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """Mutual friends dataset."""
16
+
17
+ from __future__ import absolute_import, division, print_function
18
+
19
+ import json
20
+
21
+ import datasets
22
+
23
+
24
+ _CITATION = """\
25
+ @inproceedings{he-etal-2017-learning,
26
+ title = "Learning Symmetric Collaborative Dialogue Agents with Dynamic Knowledge Graph Embeddings",
27
+ author = "He, He and
28
+ Balakrishnan, Anusha and
29
+ Eric, Mihail and
30
+ Liang, Percy",
31
+ booktitle = "Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
32
+ month = jul,
33
+ year = "2017",
34
+ address = "Vancouver, Canada",
35
+ publisher = "Association for Computational Linguistics",
36
+ url = "https://www.aclweb.org/anthology/P17-1162",
37
+ doi = "10.18653/v1/P17-1162",
38
+ pages = "1766--1776",
39
+ abstract = "We study a \textit{symmetric collaborative dialogue} setting in which two agents, each with private knowledge, must strategically communicate to achieve a common goal. The open-ended dialogue state in this setting poses new challenges for existing dialogue systems. We collected a dataset of 11K human-human dialogues, which exhibits interesting lexical, semantic, and strategic elements. To model both structured knowledge and unstructured language, we propose a neural model with dynamic knowledge graph embeddings that evolve as the dialogue progresses. Automatic and human evaluations show that our model is both more effective at achieving the goal and more human-like than baseline neural and rule-based models.",
40
+ }
41
+ """
42
+
43
+ _DESCRIPTION = """\
44
+ Our goal is to build systems that collaborate with people by exchanging
45
+ information through natural language and reasoning over structured knowledge
46
+ base. In the MutualFriend task, two agents, A and B, each have a private
47
+ knowledge base, which contains a list of friends with multiple attributes
48
+ (e.g., name, school, major, etc.). The agents must chat with each other
49
+ to find their unique mutual friend."""
50
+
51
+ _HOMEPAGE = "https://stanfordnlp.github.io/cocoa/"
52
+
53
+ _LICENSE = "Unknown"
54
+
55
+ _URLs = {
56
+ "train": "https://worksheets.codalab.org/rest/bundles/0x09c73c9db1134621bcc827689c6c3c61/contents/blob/train.json",
57
+ "dev": "https://worksheets.codalab.org/rest/bundles/0x09c73c9db1134621bcc827689c6c3c61/contents/blob/dev.json",
58
+ "test": "https://worksheets.codalab.org/rest/bundles/0x09c73c9db1134621bcc827689c6c3c61/contents/blob/test.json",
59
+ }
60
+
61
+
62
+ class MutualFriends(datasets.GeneratorBasedBuilder):
63
+ """Mutual Friends dataset."""
64
+
65
+ VERSION = datasets.Version("1.1.0")
66
+
67
+ BUILDER_CONFIGS = [
68
+ datasets.BuilderConfig(
69
+ name="plain_text",
70
+ description="Plain text",
71
+ version=VERSION,
72
+ ),
73
+ ]
74
+
75
+ def _info(self):
76
+ return datasets.DatasetInfo(
77
+ description=_DESCRIPTION,
78
+ features=datasets.Features(
79
+ {
80
+ "uuid": datasets.Value("string"),
81
+ "scenario_uuid": datasets.Value("string"),
82
+ "scenario_alphas": datasets.Sequence(datasets.Value("float32")),
83
+ "scenario_attributes": datasets.Sequence(
84
+ {
85
+ "unique": datasets.Value("bool_"),
86
+ "value_type": datasets.Value("string"),
87
+ "name": datasets.Value("string"),
88
+ }
89
+ ),
90
+ "scenario_kbs": datasets.Sequence(
91
+ datasets.Sequence(
92
+ datasets.Sequence(
93
+ datasets.Sequence(datasets.Value("string")),
94
+ )
95
+ )
96
+ ),
97
+ "agents": {
98
+ "1": datasets.Value("string"),
99
+ "0": datasets.Value("string"),
100
+ },
101
+ "outcome_reward": datasets.Value("int32"),
102
+ "events": {
103
+ "actions": datasets.Sequence(datasets.Value("string")),
104
+ "start_times": datasets.Sequence(datasets.Value("float32")),
105
+ "data_messages": datasets.Sequence(datasets.Value("string")),
106
+ "data_selects": datasets.Sequence(
107
+ {
108
+ "attributes": datasets.Sequence(datasets.Value("string")),
109
+ "values": datasets.Sequence(datasets.Value("string")),
110
+ }
111
+ ),
112
+ "agents": datasets.Sequence(datasets.Value("int32")),
113
+ "times": datasets.Sequence(datasets.Value("float32")),
114
+ },
115
+ }
116
+ ),
117
+ supervised_keys=None,
118
+ homepage=_HOMEPAGE,
119
+ license=_LICENSE,
120
+ citation=_CITATION,
121
+ )
122
+
123
+ def _split_generators(self, dl_manager):
124
+ """Returns SplitGenerators."""
125
+ data_dir = dl_manager.download_and_extract(_URLs)
126
+ return [
127
+ datasets.SplitGenerator(
128
+ name=datasets.Split.TRAIN,
129
+ gen_kwargs={
130
+ "filepath": data_dir["train"],
131
+ },
132
+ ),
133
+ datasets.SplitGenerator(
134
+ name=datasets.Split.TEST,
135
+ gen_kwargs={
136
+ "filepath": data_dir["test"],
137
+ },
138
+ ),
139
+ datasets.SplitGenerator(
140
+ name=datasets.Split.VALIDATION,
141
+ gen_kwargs={
142
+ "filepath": data_dir["dev"],
143
+ },
144
+ ),
145
+ ]
146
+
147
+ def _generate_examples(self, filepath):
148
+ """ Yields examples. """
149
+ with open(filepath, encoding="utf-8") as f:
150
+ mutualfriends = json.load(f)
151
+
152
+ for id_, dialogue in enumerate(mutualfriends):
153
+ uuid = dialogue["uuid"]
154
+ scenario_uuid = dialogue["scenario_uuid"]
155
+
156
+ scenario = dialogue["scenario"]
157
+ # Note that scenario["uuid"] == scenario_uuid all the time in the data
158
+ scenario_alphas = scenario["alphas"]
159
+ scenario_attributes = scenario["attributes"]
160
+ scenario_kbs = [
161
+ [
162
+ [
163
+ list(person.keys()), # scenario_kbs_keys
164
+ list(person.values()), # scenario_kbs_values
165
+ ]
166
+ for person in kb
167
+ ]
168
+ for kb in scenario["kbs"]
169
+ ] # The keys are not fixed, so "linearizing" the dictionaries
170
+
171
+ agents = dialogue["agents"]
172
+ outcome_reward = dialogue["outcome"]["reward"]
173
+
174
+ events_actions = []
175
+ events_start_times = []
176
+ events_data_messages = []
177
+ events_data_selects = []
178
+ events_agents = []
179
+ events_times = []
180
+ for turn in dialogue["events"]:
181
+ act = turn["action"]
182
+ events_actions.append(act)
183
+ events_start_times.append(-1 if turn["start_time"] is None else turn["start_time"])
184
+ # Note that turn["start_time"] == None in the data
185
+ if act == "message":
186
+ events_data_messages.append(turn["data"])
187
+ events_data_selects.append({"attributes": [], "values": []})
188
+ elif act == "select":
189
+ events_data_messages.append("")
190
+ events_data_selects.append(
191
+ {
192
+ "attributes": list(turn["data"].keys()),
193
+ "values": list(turn["data"].values()),
194
+ }
195
+ )
196
+ events_agents.append(turn["agent"])
197
+ events_times.append(turn["time"])
198
+ events = {
199
+ "actions": events_actions,
200
+ "start_times": events_start_times,
201
+ "data_messages": events_data_messages,
202
+ "data_selects": events_data_selects,
203
+ "agents": events_agents,
204
+ "times": events_times,
205
+ }
206
+
207
+ yield id_, {
208
+ "uuid": uuid,
209
+ "scenario_uuid": scenario_uuid,
210
+ "scenario_alphas": scenario_alphas,
211
+ "scenario_attributes": scenario_attributes,
212
+ "scenario_kbs": scenario_kbs,
213
+ "agents": agents,
214
+ "outcome_reward": outcome_reward,
215
+ "events": events,
216
+ }