silver commited on
Commit
0d8cd67
0 Parent(s):
.gitattributes ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ mmchat/dialog_train.jsonl.gz filter=lfs diff=lfs merge=lfs -text
2
+ mmchat/img_url_dev.jsonl.gz filter=lfs diff=lfs merge=lfs -text
3
+ mmchat/img_url_train.jsonl.gz filter=lfs diff=lfs merge=lfs -text
4
+ mmchat/weibo_test.jsonl.gz filter=lfs diff=lfs merge=lfs -text
5
+ mmchat/dialog_dev.jsonl.gz filter=lfs diff=lfs merge=lfs -text
6
+ mmchat/img_url_test.jsonl.gz filter=lfs diff=lfs merge=lfs -text
7
+ mmchat/weibo_dev.jsonl.gz filter=lfs diff=lfs merge=lfs -text
8
+ mmchat/weibo_train.jsonl.gz filter=lfs diff=lfs merge=lfs -text
9
+ mmchat/dialog_test.jsonl.gz filter=lfs diff=lfs merge=lfs -text
10
+ mmchat_hf/human_annotation.jsonl.gz filter=lfs diff=lfs merge=lfs -text
11
+ mmchat_hf/weibo_img_expanded_url.jsonl.gz filter=lfs diff=lfs merge=lfs -text
12
+ mmchat_hf/weibo.jsonl.gz filter=lfs diff=lfs merge=lfs -text
13
+ mmchat_hf/dialog.jsonl.gz filter=lfs diff=lfs merge=lfs -text
14
+ mmchat_raw/dialog_raw.jsonl.gz filter=lfs diff=lfs merge=lfs -text
15
+ mmchat_raw/weibo_img_expanded_url_raw.jsonl.gz filter=lfs diff=lfs merge=lfs -text
16
+ mmchat_raw/weibo_raw.jsonl.gz filter=lfs diff=lfs merge=lfs -text
17
+ mmchat_lccc_filtered/dialog_lccc_flt.jsonl.gz filter=lfs diff=lfs merge=lfs -text
18
+ mmchat_lccc_filtered/weibo_img_expanded_url_lccc_flt.jsonl.gz filter=lfs diff=lfs merge=lfs -text
19
+ mmchat_lccc_filtered/weibo_lccc_flt.jsonl.gz filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - other
4
+ language_creators:
5
+ - other
6
+ languages:
7
+ - zh
8
+ licenses:
9
+ - mit
10
+ multilinguality:
11
+ - monolingual
12
+ paperswithcode_id: mmchat-multi-modal-chat-dataset-on-social
13
+ pretty_name: "MMChat: Multi-Modal Chat Dataset on Social Media"
14
+ size_categories:
15
+ - 10M<n<100M
16
+ source_datasets:
17
+ - original
18
+ task_categories:
19
+ - conversational
20
+ task_ids:
21
+ - dialogue-generation
22
+ ---
23
+
24
+ # Dataset Card for MMChat
25
+
26
+ ## Table of Contents
27
+ - [Dataset Card for MMChat](#dataset-card-for-mmchat)
28
+ - [Table of Contents](#table-of-contents)
29
+ - [Dataset Description](#dataset-description)
30
+ - [Dataset Summary](#dataset-summary)
31
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
32
+ - [Languages](#languages)
33
+ - [Dataset Structure](#dataset-structure)
34
+ - [Data Instances](#data-instances)
35
+ - [Data Fields](#data-fields)
36
+ - [Data Splits](#data-splits)
37
+ - [Dataset Creation](#dataset-creation)
38
+ - [Curation Rationale](#curation-rationale)
39
+ - [Source Data](#source-data)
40
+ - [Initial Data Collection and Normalization](#initial-data-collection-and-normalization)
41
+ - [Who are the source language producers?](#who-are-the-source-language-producers)
42
+ - [Annotations](#annotations)
43
+ - [Annotation process](#annotation-process)
44
+ - [Who are the annotators?](#who-are-the-annotators)
45
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
46
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
47
+ - [Social Impact of Dataset](#social-impact-of-dataset)
48
+ - [Discussion of Biases](#discussion-of-biases)
49
+ - [Other Known Limitations](#other-known-limitations)
50
+ - [Additional Information](#additional-information)
51
+ - [Dataset Curators](#dataset-curators)
52
+ - [Licensing Information](#licensing-information)
53
+ - [Citation Information](#citation-information)
54
+ - [Contributions](#contributions)
55
+
56
+ ## Dataset Description
57
+
58
+ - **Homepage:** https://www.zhengyinhe.com/datasets/
59
+ - **Repository:** https://github.com/silverriver/MMChat
60
+ - **Paper:** https://arxiv.org/abs/2108.07154
61
+
62
+ ### Dataset Summary
63
+
64
+ MMChat is a large-scale dialogue dataset that contains image-grounded dialogues in Chinese. Each dialogue in MMChat is associated with one or more images (maximum 9 images per dialogue). We design various strategies to ensure the quality of the dialogues in MMChat.
65
+
66
+ MMChat comes with 4 different versions:
67
+
68
+ - `mmchat`: The MMChat dataset used in our paper.
69
+ - `mmchat_hf`: Contains human annotation on 100K sessions of dialogues.
70
+ - `mmchat_raw`: Raw dialogues used to construct MMChat.
71
+ `mmchat_lccc_filtered`: Raw dialogues filtered using the LCCC dataset.
72
+
73
+ If you what to use high quality multi-modal dialogues that are closed related to the given images, I suggest you to use the `mmchat_hf` version.
74
+ If you only care about the quality of dialogue texts, I suggest you to use the `mmchat_lccc_filtered` version.
75
+
76
+ ### Supported Tasks and Leaderboards
77
+
78
+ - dialogue-generation: The dataset can be used to train a model for generating dialogue responses.
79
+ - response-retrieval: The dataset can be used to train a reranker model that can be used to implement a retrieval-based dialogue model.
80
+
81
+ ### Languages
82
+
83
+ MMChat is in Chinese
84
+
85
+ MMChat中的对话是中文的
86
+
87
+ ## Dataset Structure
88
+
89
+ ### Data Instances
90
+
91
+ Several versions of MMChat are available. For `mmchat`, `mmchat_raw`, `mmchat_lccc_filtered`, the following instance applies:
92
+
93
+ ```json
94
+ {
95
+ "dialog": ["你只拍出了你十分之一的美", "你的头像竟然换了,奥"],
96
+ "weibo_content": "分享图片",
97
+ "imgs": ["https://wx4.sinaimg.cn/mw2048/d716a6e2ly1fmug2w2l9qj21o02yox6p.jpg"]
98
+ }
99
+ ```
100
+
101
+ For `mmchat_hf`, the following instance applies:
102
+
103
+ ```json
104
+ {
105
+ "dialog": ["白百合", "啊?", "有点像", "还好吧哈哈哈牙像", "有男盆友没呢", "还没", "和你说话呢。没回我"],
106
+ "weibo_content": "补一张昨天礼仪的照片",
107
+ "imgs": ["https://ww2.sinaimg.cn/mw2048/005Co9wdjw1eyoz7ib9n5j307w0bu3z5.jpg"],
108
+ "labels": {
109
+ "image_qualified": true,
110
+ "dialog_qualified": true,
111
+ "dialog_image_related": true
112
+ }
113
+ }
114
+ ```
115
+
116
+ ### Data Fields
117
+
118
+ - `dialog` (list of strings): List of utterances consisting of a dialogue.
119
+ - `weibo_content` (string): Weibo content of the dialogue.
120
+ - `imgs` (list of strings): List of URLs of images.
121
+ - `labels` (dict): Human-annotated labels of the dialogue.
122
+ - `image_qualified` (bool): Whether the image is of high quality.
123
+ - `dialog_qualified` (bool): Whether the dialogue is of high quality.
124
+ - `dialog_image_related` (bool): Whether the dialogue is related to the image.
125
+
126
+ ### Data Splits
127
+
128
+ For `mmchat`, we provide the following splits:
129
+
130
+ |train|valid|test|
131
+ |---:|---:|---:|
132
+ |115,842 | 4,000 | 1,000 |
133
+
134
+ For other versions, we do not provide the offical split.
135
+ More stastics are listed here:
136
+
137
+ | `mmchat` | Count |
138
+ |--------------------------------------|--------:|
139
+ | Sessions | 120.84 K |
140
+ | Sessions with more than 4 utterances | 17.32 K |
141
+ | Utterances | 314.13 K |
142
+ | Images | 198.82 K |
143
+ | Avg. utterance per session | 2.599 |
144
+ | Avg. image per session | 2.791 |
145
+ | Avg. character per utterance | 8.521 |
146
+
147
+ | `mmchat_hf` | Count |
148
+ |--------------------------------------|--------:|
149
+ | Sessions | 19.90 K |
150
+ | Sessions with more than 4 utterances | 8.91 K |
151
+ | Totally annotated sessions | 100.01 K |
152
+ | Utterances | 81.06 K |
153
+ | Images | 52.66K |
154
+ | Avg. utterance per session | 4.07 |
155
+ | Avg. image per session | 2.70 |
156
+ | Avg. character per utterance | 11.93 |
157
+
158
+ | `mmchat_raw` | Count |
159
+ |--------------------------------------|---------:|
160
+ | Sessions | 4.257 M |
161
+ | Sessions with more than 4 utterances | 2.304 M |
162
+ | Utterances | 18.590 M |
163
+ | Images | 4.874 M |
164
+ | Avg. utterance per session | 4.367 |
165
+ | Avg. image per session | 1.670 |
166
+ | Avg. character per utterance | 14.104 |
167
+
168
+ | `mmchat_lccc_filtered` | Count |
169
+ |--------------------------------------|--------:|
170
+ | Sessions | 492.6 K |
171
+ | Sessions with more than 4 utterances | 208.8 K |
172
+ | Utterances | 1.986 M |
173
+ | Images | 1.066 M |
174
+ | Avg. utterance per session | 4.031 |
175
+ | Avg. image per session | 2.514 |
176
+ | Avg. character per utterance | 11.336 |
177
+
178
+ ## Dataset Creation
179
+
180
+ ### Curation Rationale
181
+
182
+ [Needs More Information]
183
+
184
+ ### Source Data
185
+
186
+ #### Initial Data Collection and Normalization
187
+
188
+ [Needs More Information]
189
+
190
+ #### Who are the source language producers?
191
+
192
+ [Needs More Information]
193
+
194
+ ### Annotations
195
+
196
+ #### Annotation process
197
+
198
+ [Needs More Information]
199
+
200
+ #### Who are the annotators?
201
+
202
+ [Needs More Information]
203
+
204
+ ### Personal and Sensitive Information
205
+
206
+ [Needs More Information]
207
+
208
+ ## Considerations for Using the Data
209
+
210
+ ### Social Impact of Dataset
211
+
212
+ [Needs More Information]
213
+
214
+ ### Discussion of Biases
215
+
216
+ [Needs More Information]
217
+
218
+ ### Other Known Limitations
219
+
220
+ [Needs More Information]
221
+
222
+ ## Additional Information
223
+
224
+ ### Dataset Curators
225
+
226
+ [Needs More Information]
227
+
228
+ ### Licensing Information
229
+
230
+ [Needs More Information]
231
+
232
+ ### Citation Information
233
+
234
+ ```
235
+ @inproceedings{zheng2022MMChat,
236
+ author = {Zheng, Yinhe and Chen, Guanyi and Liu, Xin and Sun, Jian},
237
+ title = {MMChat: Multi-Modal Chat Dataset on Social Media},
238
+ booktitle = {Proceedings of The 13th Language Resources and Evaluation Conference},
239
+ year = {2022},
240
+ publisher = {European Language Resources Association},
241
+ }
242
+
243
+ @inproceedings{wang2020chinese,
244
+ title={A Large-Scale Chinese Short-Text Conversation Dataset},
245
+ author={Wang, Yida and Ke, Pei and Zheng, Yinhe and Huang, Kaili and Jiang, Yong and Zhu, Xiaoyan and Huang, Minlie},
246
+ booktitle={NLPCC},
247
+ year={2020},
248
+ url={https://arxiv.org/abs/2008.03946}
249
+ }
250
+ ```
251
+
252
+ ### Contributions
253
+
254
+ Thanks to [Yinhe Zheng](https://github.com/silverriver) for adding this dataset.
mmchat.py ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """
15
+ MMChat is a large-scale dialogue dataset that contains image-grounded dialogues in Chinese.
16
+ Each dialogue in MMChat is associated with one or more images (maximum 9 images per dialogue).
17
+ We design various strategies to ensure the quality of the dialogues in MMChat.
18
+ """
19
+
20
+ import json
21
+ import os
22
+
23
+ import datasets
24
+
25
+
26
+ _CITATION = """\
27
+ @inproceedings{zheng2022MMChat,
28
+ author = {Zheng, Yinhe and Chen, Guanyi and Liu, Xin and Sun, Jian},
29
+ title = {MMChat: Multi-Modal Chat Dataset on Social Media},
30
+ booktitle = {Proceedings of The 13th Language Resources and Evaluation Conference},
31
+ year = {2022},
32
+ publisher = {European Language Resources Association},
33
+ }
34
+
35
+ @inproceedings{wang2020chinese,
36
+ title = {A Large-Scale Chinese Short-Text Conversation Dataset},
37
+ author = {Wang, Yida and Ke, Pei and Zheng, Yinhe and Huang, Kaili and Jiang, Yong and Zhu, Xiaoyan and Huang, Minlie},
38
+ booktitle = {NLPCC},
39
+ year = {2020},
40
+ url = {https://arxiv.org/abs/2008.03946}
41
+ }
42
+ """
43
+
44
+ _DESCRIPTION = """\
45
+ MMChat is a large-scale dialogue dataset that contains image-grounded dialogues in Chinese.
46
+ Each dialogue in MMChat is associated with one or more images (maximum 9 images per dialogue).
47
+ We design various strategies to ensure the quality of the dialogues in MMChat.
48
+ """
49
+
50
+ _HOMEPAGE = "https://github.com/silverriver/MMChat"
51
+
52
+ _LICENSE = "MIT"
53
+
54
+ _URLS = {
55
+ "mmchat": ["https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat.tgz"],
56
+ "mmchat_hf": ["https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_hf.tgz"],
57
+ "mmchat_raw": [
58
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_raw/MMChat_split0.tgz",
59
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_raw/MMChat_split1.tgz",
60
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_raw/MMChat_split2.tgz",
61
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_raw/MMChat_split3.tgz",
62
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_raw/MMChat_split4.tgz",
63
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_raw/MMChat_split5.tgz",
64
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_raw/MMChat_split6.tgz",
65
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_raw/MMChat_split7.tgz",
66
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_raw/MMChat_split8.tgz",
67
+ ],
68
+ "mmchat_lccc_filtered": [
69
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_lccc_filtered/MMChat_lccc_flt_split0.tgz",
70
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_lccc_filtered/MMChat_lccc_flt_split1.tgz",
71
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_lccc_filtered/MMChat_lccc_flt_split2.tgz",
72
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_lccc_filtered/MMChat_lccc_flt_split3.tgz",
73
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_lccc_filtered/MMChat_lccc_flt_split4.tgz",
74
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_lccc_filtered/MMChat_lccc_flt_split5.tgz",
75
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_lccc_filtered/MMChat_lccc_flt_split6.tgz",
76
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_lccc_filtered/MMChat_lccc_flt_split7.tgz",
77
+ "https://huggingface.co/datasets/silver/mmchat/resolve/main/mmchat_lccc_filtered/MMChat_lccc_flt_split8.tgz",
78
+ ],
79
+ }
80
+
81
+
82
+ class MMChat(datasets.GeneratorBasedBuilder):
83
+ """Multi-Modal Chat Dataset."""
84
+
85
+ VERSION = datasets.Version("1.0.0")
86
+ BUILDER_CONFIGS = [
87
+ datasets.BuilderConfig(name="mmchat", version=VERSION, description="The MMChat dataset"),
88
+ datasets.BuilderConfig(name="mmchat_hf", version=VERSION, description="Human filtered version of MMChat"),
89
+ datasets.BuilderConfig(name="mmchat_raw", version=VERSION, description="Raw dialogues in MMChat"),
90
+ datasets.BuilderConfig(name="mmchat_lccc_filtered", version=VERSION, description="LCCC filtered MMChat"),
91
+ ]
92
+
93
+ DEFAULT_CONFIG_NAME = "mmchat"
94
+
95
+ def _info(self):
96
+ if self.config.name in ["mmchat", "mmchat_raw", "mmchat_lccc_filtered"]:
97
+ features = datasets.Features(
98
+ {
99
+ "dialog": [datasets.Value("string")],
100
+ "weibo_content": datasets.Value("string"),
101
+ "imgs": [datasets.Value("string")],
102
+ }
103
+ )
104
+ else:
105
+ features = datasets.Features(
106
+ {
107
+ "dialog": [datasets.Value("string")],
108
+ "weibo_content": datasets.Value("string"),
109
+ "imgs": [datasets.Value("string")],
110
+ "labels": {
111
+ "image_qualified": datasets.Value("bool"),
112
+ "dialog_qualified": datasets.Value("bool"),
113
+ "dialog_image_related": datasets.Value("bool"),
114
+ },
115
+ }
116
+ )
117
+ return datasets.DatasetInfo(
118
+ # This is the description that will appear on the datasets page.
119
+ description=_DESCRIPTION,
120
+ # This defines the different columns of the dataset and their types
121
+ features=features, # Here we define them above because they are different between the two configurations
122
+ # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
123
+ # specify them. They'll be used if as_supervised=True in builder.as_dataset.
124
+ # supervised_keys=("sentence", "label"),
125
+ # Homepage of the dataset for documentation
126
+ homepage=_HOMEPAGE,
127
+ # License for the dataset if available
128
+ license=_LICENSE,
129
+ # Citation for the dataset
130
+ citation=_CITATION,
131
+ )
132
+
133
+ def _split_generators(self, dl_manager):
134
+ urls = _URLS[self.config.name]
135
+ data_dir = dl_manager.download_and_extract(urls)
136
+ if self.config.name == "mmchat":
137
+ return [
138
+ datasets.SplitGenerator(
139
+ name=datasets.Split.TRAIN,
140
+ gen_kwargs={
141
+ "dialog_files": [os.path.join(i, "dialog_train.jsonl") for i in data_dir],
142
+ "weibo_files": [os.path.join(i, "weibo_train.jsonl") for i in data_dir],
143
+ "img_files": [os.path.join(i, "img_url_train.jsonl") for i in data_dir],
144
+ "label_files": [],
145
+ },
146
+ ),
147
+ datasets.SplitGenerator(
148
+ name=datasets.Split.TEST,
149
+ gen_kwargs={
150
+ "dialog_files": [os.path.join(i, "dialog_test.jsonl") for i in data_dir],
151
+ "weibo_files": [os.path.join(i, "weibo_test.jsonl") for i in data_dir],
152
+ "img_files": [os.path.join(i, "img_url_test.jsonl") for i in data_dir],
153
+ "label_files": [],
154
+ },
155
+ ),
156
+ datasets.SplitGenerator(
157
+ name=datasets.Split.VALIDATION,
158
+ gen_kwargs={
159
+ "dialog_files": [os.path.join(i, "dialog_dev.jsonl") for i in data_dir],
160
+ "weibo_files": [os.path.join(i, "weibo_dev.jsonl") for i in data_dir],
161
+ "img_files": [os.path.join(i, "img_url_dev.jsonl") for i in data_dir],
162
+ "label_files": [],
163
+ },
164
+ ),
165
+ ]
166
+ elif self.config.name == "mmchat_hf":
167
+ return [
168
+ datasets.SplitGenerator(
169
+ name=datasets.Split.TRAIN,
170
+ gen_kwargs={
171
+ "dialog_files": [os.path.join(i, "dialog.jsonl") for i in data_dir],
172
+ "weibo_files": [os.path.join(i, "weibo.jsonl") for i in data_dir],
173
+ "img_files": [os.path.join(i, "weibo_img_expanded_url.jsonl") for i in data_dir],
174
+ "label_files": [os.path.join(i, "human_annotation.jsonl") for i in data_dir],
175
+ },
176
+ ),
177
+ ]
178
+ elif self.config.name == "mmchat_lccc_filtered":
179
+ return [
180
+ datasets.SplitGenerator(
181
+ name=datasets.Split.TRAIN,
182
+ gen_kwargs={
183
+ "dialog_files": [os.path.join(i, "dialog_lccc_flt.jsonl") for i in data_dir],
184
+ "weibo_files": [os.path.join(i, "weibo_lccc_flt.jsonl") for i in data_dir],
185
+ "img_files": [os.path.join(i, "weibo_img_expanded_url_lccc_flt.jsonl") for i in data_dir],
186
+ "label_files": [],
187
+ },
188
+ ),
189
+ ]
190
+ elif self.config.name == "mmchat_raw":
191
+ return [
192
+ datasets.SplitGenerator(
193
+ name=datasets.Split.TRAIN,
194
+ gen_kwargs={
195
+ "dialog_files": [os.path.join(i, "dialog.jsonl") for i in data_dir],
196
+ "weibo_files": [os.path.join(i, "weibo.jsonl") for i in data_dir],
197
+ "img_files": [os.path.join(i, "weibo_img_expanded_url.jsonl") for i in data_dir],
198
+ "label_files": [],
199
+ },
200
+ ),
201
+ ]
202
+
203
+ # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
204
+ def _generate_examples(self, dialog_files, weibo_files, img_files, label_files):
205
+ id = 0
206
+ assert len(dialog_files) == len(weibo_files) == len(img_files)
207
+ if len(label_files) == 0:
208
+ label_files = [None] * len(dialog_files)
209
+ for dialog_file, weibo_file, img_file, label_file in zip(dialog_files, weibo_files, img_files, label_files):
210
+ if label_file is not None:
211
+ label_f = open(label_file, encoding="utf-8")
212
+
213
+ with open(dialog_file, encoding="utf-8") as dialog_f, open(weibo_file, encoding="utf-8") as weibo_f, open(
214
+ img_file, encoding="utf-8"
215
+ ) as img_f:
216
+ while True:
217
+ try:
218
+ dialog_line = dialog_f.readline().strip()
219
+ if len(dialog_line) == 0:
220
+ break
221
+ dialog = json.loads(dialog_line) # dialog_f.readline())
222
+ weibo = json.loads(weibo_f.readline())
223
+ if self.config.name == "mmchat":
224
+ imgs = img_f.readline().strip().split(";")
225
+ else:
226
+ imgs = json.loads(img_f.readline())["weibo_img"].split(";")
227
+
228
+ if self.config.name == "mmchat_hf":
229
+ label = json.loads(label_f.readline())
230
+ # Yields examples as (key, example) tuples
231
+ yield id, {
232
+ "dialog": dialog,
233
+ "weibo_content": weibo,
234
+ "imgs": imgs,
235
+ "labels": {
236
+ "image_qualified": True if label["image_quality"] == "1" else False,
237
+ "dialog_qualified": True if label["dialog_quality"] == "1" else False,
238
+ "dialog_image_related": True
239
+ if label["dialog_image_relativeness"] == "1"
240
+ else False,
241
+ },
242
+ }
243
+ else:
244
+ yield id, {
245
+ "dialog": dialog,
246
+ "weibo_content": weibo,
247
+ "imgs": imgs,
248
+ }
249
+ id += 1
250
+ except EOFError:
251
+ break
252
+ if label_file is not None:
253
+ label_f.close()
mmchat/dialog_dev.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bf241f920b088b8e1d1bfd3c62d41cca9e76d60f9d35dc0da71d4ca4ee2855b4
3
+ size 35976
mmchat/dialog_test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f285407f893abc385588160a674c6ad846bce93f0a821acf093bcd8a8d40e685
3
+ size 141556
mmchat/dialog_train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7dd8948dbbd7d3865a69df7c737b3f2c530d57258ca378ab74aca1f4587d7fb5
3
+ size 4001249
mmchat/img_url_dev.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7322d42af425820fc4cdb570a9400bc2623f726d304131ab2494fc11779309eb
3
+ size 46607
mmchat/img_url_test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9db4713683a665764085e7480165a7f7c038b2c6239d1c744976298363a5579e
3
+ size 188377
mmchat/img_url_train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9337c9e96497f0f8d6c01ee30afd7c1feaafd2f669661fe48052f41e3baf7aeb
3
+ size 5301433
mmchat/weibo_dev.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f6cef2b570a3aa187d823ab5330806e79f9dd66e4ade4cae78ef7815764d2ee
3
+ size 101
mmchat/weibo_test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3eaabda17b2e4df3985f6f302f2581ed818a03ae04cc7112f7feb1fcddc4c47b
3
+ size 189
mmchat/weibo_train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cbcc11ccea2d9dd75047c7fe80ecc3eceaddf555eb2136c5cae78725cb44ed54
3
+ size 3441
mmchat_hf/dialog.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:15fcf7756ec5ca39398a4ab9d68d14c403b1f4273781130f90dacb55a862c58a
3
+ size 6826130
mmchat_hf/human_annotation.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d34e113027e86f44af220c2c9ce09f909aaff045cd94fd5886b79a972b6e0b4
3
+ size 358333
mmchat_hf/weibo.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4031029e1abbdca3fa71755796a52f8f6788ae77390f2b7107822b8eb792bcb0
3
+ size 7084046
mmchat_hf/weibo_img_expanded_url.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:58fccfe34603c92dcb435dde7f7f77f7468dba2df369a412a927d65041f18724
3
+ size 7781846
mmchat_lccc_filtered/dialog_lccc_flt.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54ad76f67269f1adf3a974acfb71f79299283b1bdefbdb5e2928b8d52b53a64d
3
+ size 33623526
mmchat_lccc_filtered/weibo_img_expanded_url_lccc_flt.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6ffd6c8420ef37e6b5a2e88f054f0d5ae849617dea501c3342a512e63ba12a59
3
+ size 38226987
mmchat_lccc_filtered/weibo_lccc_flt.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4900fd5f711fdcc752a60e84edcb6e16fcb9f2100f8b900ccf88af9a780816a
3
+ size 34990489
mmchat_raw/dialog_raw.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8d36cd302c42eee9a9d39032ff0e1d05975bd5aa2030eecd595e2e2964f6cadf
3
+ size 389104370
mmchat_raw/weibo_img_expanded_url_raw.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d0deae3fe9b2bced80ba424fa9110a4e52b583f5823723832ac628e943e0a228
3
+ size 268962111
mmchat_raw/weibo_raw.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d2616195f89040a0cb81d16261293f9ff002d2eb7981eebde2f631069f202521
3
+ size 329066732