Datasets:
Commit ·
0c44c0e
0
Parent(s):
Duplicate from facebook/empathetic_dialogues
Browse filesCo-authored-by: Parquet-converter (BOT) <parquet-converter@users.noreply.huggingface.co>
- .gitattributes +27 -0
- README.md +224 -0
- empathetic_dialogues.py +106 -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,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
annotations_creators:
|
| 3 |
+
- crowdsourced
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
language_creators:
|
| 7 |
+
- crowdsourced
|
| 8 |
+
license:
|
| 9 |
+
- cc-by-nc-4.0
|
| 10 |
+
multilinguality:
|
| 11 |
+
- monolingual
|
| 12 |
+
pretty_name: EmpatheticDialogues
|
| 13 |
+
size_categories:
|
| 14 |
+
- 10K<n<100K
|
| 15 |
+
source_datasets:
|
| 16 |
+
- original
|
| 17 |
+
task_categories:
|
| 18 |
+
- conversational
|
| 19 |
+
- question-answering
|
| 20 |
+
task_ids:
|
| 21 |
+
- dialogue-generation
|
| 22 |
+
- open-domain-qa
|
| 23 |
+
paperswithcode_id: empatheticdialogues
|
| 24 |
+
dataset_info:
|
| 25 |
+
features:
|
| 26 |
+
- name: conv_id
|
| 27 |
+
dtype: string
|
| 28 |
+
- name: utterance_idx
|
| 29 |
+
dtype: int32
|
| 30 |
+
- name: context
|
| 31 |
+
dtype: string
|
| 32 |
+
- name: prompt
|
| 33 |
+
dtype: string
|
| 34 |
+
- name: speaker_idx
|
| 35 |
+
dtype: int32
|
| 36 |
+
- name: utterance
|
| 37 |
+
dtype: string
|
| 38 |
+
- name: selfeval
|
| 39 |
+
dtype: string
|
| 40 |
+
- name: tags
|
| 41 |
+
dtype: string
|
| 42 |
+
splits:
|
| 43 |
+
- name: test
|
| 44 |
+
num_bytes: 3011332
|
| 45 |
+
num_examples: 10943
|
| 46 |
+
- name: train
|
| 47 |
+
num_bytes: 19040509
|
| 48 |
+
num_examples: 76673
|
| 49 |
+
- name: validation
|
| 50 |
+
num_bytes: 3077481
|
| 51 |
+
num_examples: 12030
|
| 52 |
+
download_size: 28022709
|
| 53 |
+
dataset_size: 25129322
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
# Dataset Card for "empathetic_dialogues"
|
| 57 |
+
|
| 58 |
+
## Table of Contents
|
| 59 |
+
- [Dataset Description](#dataset-description)
|
| 60 |
+
- [Dataset Summary](#dataset-summary)
|
| 61 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
| 62 |
+
- [Languages](#languages)
|
| 63 |
+
- [Dataset Structure](#dataset-structure)
|
| 64 |
+
- [Data Instances](#data-instances)
|
| 65 |
+
- [Data Fields](#data-fields)
|
| 66 |
+
- [Data Splits](#data-splits)
|
| 67 |
+
- [Dataset Creation](#dataset-creation)
|
| 68 |
+
- [Curation Rationale](#curation-rationale)
|
| 69 |
+
- [Source Data](#source-data)
|
| 70 |
+
- [Annotations](#annotations)
|
| 71 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
| 72 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
| 73 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
| 74 |
+
- [Discussion of Biases](#discussion-of-biases)
|
| 75 |
+
- [Other Known Limitations](#other-known-limitations)
|
| 76 |
+
- [Additional Information](#additional-information)
|
| 77 |
+
- [Dataset Curators](#dataset-curators)
|
| 78 |
+
- [Licensing Information](#licensing-information)
|
| 79 |
+
- [Citation Information](#citation-information)
|
| 80 |
+
- [Contributions](#contributions)
|
| 81 |
+
|
| 82 |
+
## Dataset Description
|
| 83 |
+
|
| 84 |
+
- **Homepage:** [https://github.com/facebookresearch/EmpatheticDialogues](https://github.com/facebookresearch/EmpatheticDialogues)
|
| 85 |
+
- **Repository:** https://github.com/facebookresearch/EmpatheticDialogues
|
| 86 |
+
- **Paper:** [Towards Empathetic Open-domain Conversation Models: a New Benchmark and Dataset](https://arxiv.org/abs/1811.00207)
|
| 87 |
+
- **Point of Contact:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 88 |
+
- **Size of downloaded dataset files:** 28.02 MB
|
| 89 |
+
- **Size of the generated dataset:** 25.13 MB
|
| 90 |
+
- **Total amount of disk used:** 53.15 MB
|
| 91 |
+
|
| 92 |
+
### Dataset Summary
|
| 93 |
+
|
| 94 |
+
PyTorch original implementation of Towards Empathetic Open-domain Conversation Models: a New Benchmark and Dataset
|
| 95 |
+
|
| 96 |
+
### Supported Tasks and Leaderboards
|
| 97 |
+
|
| 98 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 99 |
+
|
| 100 |
+
### Languages
|
| 101 |
+
|
| 102 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 103 |
+
|
| 104 |
+
## Dataset Structure
|
| 105 |
+
|
| 106 |
+
### Data Instances
|
| 107 |
+
|
| 108 |
+
#### default
|
| 109 |
+
|
| 110 |
+
- **Size of downloaded dataset files:** 28.02 MB
|
| 111 |
+
- **Size of the generated dataset:** 25.13 MB
|
| 112 |
+
- **Total amount of disk used:** 53.15 MB
|
| 113 |
+
|
| 114 |
+
An example of 'train' looks as follows.
|
| 115 |
+
```
|
| 116 |
+
{
|
| 117 |
+
"context": "sentimental",
|
| 118 |
+
"conv_id": "hit:0_conv:1",
|
| 119 |
+
"prompt": "I remember going to the fireworks with my best friend. There was a lot of people_comma_ but it only felt like us in the world.",
|
| 120 |
+
"selfeval": "5|5|5_2|2|5",
|
| 121 |
+
"speaker_idx": 1,
|
| 122 |
+
"tags": "",
|
| 123 |
+
"utterance": "I remember going to see the fireworks with my best friend. It was the first time we ever spent time alone together. Although there was a lot of people_comma_ we felt like the only people in the world.",
|
| 124 |
+
"utterance_idx": 1
|
| 125 |
+
}
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
### Data Fields
|
| 129 |
+
|
| 130 |
+
The data fields are the same among all splits.
|
| 131 |
+
|
| 132 |
+
#### default
|
| 133 |
+
- `conv_id`: a `string` feature.
|
| 134 |
+
- `utterance_idx`: a `int32` feature.
|
| 135 |
+
- `context`: a `string` feature.
|
| 136 |
+
- `prompt`: a `string` feature.
|
| 137 |
+
- `speaker_idx`: a `int32` feature.
|
| 138 |
+
- `utterance`: a `string` feature.
|
| 139 |
+
- `selfeval`: a `string` feature.
|
| 140 |
+
- `tags`: a `string` feature.
|
| 141 |
+
|
| 142 |
+
### Data Splits
|
| 143 |
+
|
| 144 |
+
| name |train|validation|test |
|
| 145 |
+
|-------|----:|---------:|----:|
|
| 146 |
+
|default|76673| 12030|10943|
|
| 147 |
+
|
| 148 |
+
## Dataset Creation
|
| 149 |
+
|
| 150 |
+
### Curation Rationale
|
| 151 |
+
|
| 152 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 153 |
+
|
| 154 |
+
### Source Data
|
| 155 |
+
|
| 156 |
+
#### Initial Data Collection and Normalization
|
| 157 |
+
|
| 158 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 159 |
+
|
| 160 |
+
#### Who are the source language producers?
|
| 161 |
+
|
| 162 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 163 |
+
|
| 164 |
+
### Annotations
|
| 165 |
+
|
| 166 |
+
#### Annotation process
|
| 167 |
+
|
| 168 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 169 |
+
|
| 170 |
+
#### Who are the annotators?
|
| 171 |
+
|
| 172 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 173 |
+
|
| 174 |
+
### Personal and Sensitive Information
|
| 175 |
+
|
| 176 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 177 |
+
|
| 178 |
+
## Considerations for Using the Data
|
| 179 |
+
|
| 180 |
+
### Social Impact of Dataset
|
| 181 |
+
|
| 182 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 183 |
+
|
| 184 |
+
### Discussion of Biases
|
| 185 |
+
|
| 186 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 187 |
+
|
| 188 |
+
### Other Known Limitations
|
| 189 |
+
|
| 190 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 191 |
+
|
| 192 |
+
## Additional Information
|
| 193 |
+
|
| 194 |
+
### Dataset Curators
|
| 195 |
+
|
| 196 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 197 |
+
|
| 198 |
+
### Licensing Information
|
| 199 |
+
|
| 200 |
+
Creative Commons [Attribution-NonCommercial 4.0 International](https://creativecommons.org/licenses/by-nc/4.0/).
|
| 201 |
+
|
| 202 |
+
### Citation Information
|
| 203 |
+
|
| 204 |
+
```
|
| 205 |
+
@inproceedings{rashkin-etal-2019-towards,
|
| 206 |
+
title = "Towards Empathetic Open-domain Conversation Models: A New Benchmark and Dataset",
|
| 207 |
+
author = "Rashkin, Hannah and
|
| 208 |
+
Smith, Eric Michael and
|
| 209 |
+
Li, Margaret and
|
| 210 |
+
Boureau, Y-Lan",
|
| 211 |
+
booktitle = "Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics",
|
| 212 |
+
month = jul,
|
| 213 |
+
year = "2019",
|
| 214 |
+
address = "Florence, Italy",
|
| 215 |
+
publisher = "Association for Computational Linguistics",
|
| 216 |
+
url = "https://aclanthology.org/P19-1534",
|
| 217 |
+
doi = "10.18653/v1/P19-1534",
|
| 218 |
+
pages = "5370--5381",
|
| 219 |
+
}
|
| 220 |
+
```
|
| 221 |
+
|
| 222 |
+
### Contributions
|
| 223 |
+
|
| 224 |
+
Thanks to [@thomwolf](https://github.com/thomwolf), [@patrickvonplaten](https://github.com/patrickvonplaten), [@lewtun](https://github.com/lewtun) for adding this dataset.
|
empathetic_dialogues.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""TODO(empathetic_dialogues): Add a description here."""
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
import csv
|
| 5 |
+
|
| 6 |
+
import datasets
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
_CITATION = """\
|
| 10 |
+
@inproceedings{rashkin2019towards,
|
| 11 |
+
title = {Towards Empathetic Open-domain Conversation Models: a New Benchmark and Dataset},
|
| 12 |
+
author = {Hannah Rashkin and Eric Michael Smith and Margaret Li and Y-Lan Boureau},
|
| 13 |
+
booktitle = {ACL},
|
| 14 |
+
year = {2019},
|
| 15 |
+
}
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
+
_DESCRIPTION = """\
|
| 19 |
+
PyTorch original implementation of Towards Empathetic Open-domain Conversation Models: a New Benchmark and Dataset
|
| 20 |
+
"""
|
| 21 |
+
_URL = "https://dl.fbaipublicfiles.com/parlai/empatheticdialogues/empatheticdialogues.tar.gz"
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class EmpatheticDialogues(datasets.GeneratorBasedBuilder):
|
| 25 |
+
"""TODO(empathetic_dialogues): Short description of my dataset."""
|
| 26 |
+
|
| 27 |
+
# TODO(empathetic_dialogues): Set up version.
|
| 28 |
+
VERSION = datasets.Version("0.1.0")
|
| 29 |
+
|
| 30 |
+
def _info(self):
|
| 31 |
+
# TODO(empathetic_dialogues): Specifies the datasets.DatasetInfo object
|
| 32 |
+
return datasets.DatasetInfo(
|
| 33 |
+
# This is the description that will appear on the datasets page.
|
| 34 |
+
description=_DESCRIPTION,
|
| 35 |
+
# datasets.features.FeatureConnectors
|
| 36 |
+
features=datasets.Features(
|
| 37 |
+
{
|
| 38 |
+
"conv_id": datasets.Value("string"),
|
| 39 |
+
"utterance_idx": datasets.Value("int32"),
|
| 40 |
+
"context": datasets.Value("string"),
|
| 41 |
+
"prompt": datasets.Value("string"),
|
| 42 |
+
"speaker_idx": datasets.Value("int32"),
|
| 43 |
+
"utterance": datasets.Value("string"),
|
| 44 |
+
"selfeval": datasets.Value("string"),
|
| 45 |
+
"tags": datasets.Value("string")
|
| 46 |
+
# These are the features of your dataset like images, labels ...
|
| 47 |
+
}
|
| 48 |
+
),
|
| 49 |
+
# If there's a common (input, target) tuple from the features,
|
| 50 |
+
# specify them here. They'll be used if as_supervised=True in
|
| 51 |
+
# builder.as_dataset.
|
| 52 |
+
supervised_keys=None,
|
| 53 |
+
# Homepage of the dataset for documentation
|
| 54 |
+
homepage="https://github.com/facebookresearch/EmpatheticDialogues",
|
| 55 |
+
citation=_CITATION,
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
def _split_generators(self, dl_manager):
|
| 59 |
+
"""Returns SplitGenerators."""
|
| 60 |
+
# TODO(empathetic_dialogues): Downloads the data and defines the splits
|
| 61 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to
|
| 62 |
+
# download and extract URLs
|
| 63 |
+
archive = dl_manager.download(_URL)
|
| 64 |
+
return [
|
| 65 |
+
datasets.SplitGenerator(
|
| 66 |
+
name=datasets.Split.TRAIN,
|
| 67 |
+
# These kwargs will be passed to _generate_examples
|
| 68 |
+
gen_kwargs={"files": dl_manager.iter_archive(archive), "split_file": "empatheticdialogues/train.csv"},
|
| 69 |
+
),
|
| 70 |
+
datasets.SplitGenerator(
|
| 71 |
+
name=datasets.Split.VALIDATION,
|
| 72 |
+
# These kwargs will be passed to _generate_examples
|
| 73 |
+
gen_kwargs={"files": dl_manager.iter_archive(archive), "split_file": "empatheticdialogues/valid.csv"},
|
| 74 |
+
),
|
| 75 |
+
datasets.SplitGenerator(
|
| 76 |
+
name=datasets.Split.TEST,
|
| 77 |
+
# These kwargs will be passed to _generate_examples
|
| 78 |
+
gen_kwargs={"files": dl_manager.iter_archive(archive), "split_file": "empatheticdialogues/test.csv"},
|
| 79 |
+
),
|
| 80 |
+
]
|
| 81 |
+
|
| 82 |
+
def _generate_examples(self, files, split_file):
|
| 83 |
+
"""Yields examples."""
|
| 84 |
+
for path, f in files:
|
| 85 |
+
if split_file == path:
|
| 86 |
+
data = csv.DictReader(line.decode("utf-8") for line in f)
|
| 87 |
+
for id_, row in enumerate(data):
|
| 88 |
+
utterance = row["utterance"]
|
| 89 |
+
speaker_id = int(row["speaker_idx"])
|
| 90 |
+
context = row["context"]
|
| 91 |
+
conv_id = row["conv_id"]
|
| 92 |
+
tags = row["tags"] if row["tags"] else ""
|
| 93 |
+
selfeval = row["selfeval"] if row["selfeval"] else ""
|
| 94 |
+
utterance_id = int(row["utterance_idx"])
|
| 95 |
+
prompt = row["prompt"]
|
| 96 |
+
yield id_, {
|
| 97 |
+
"utterance": utterance,
|
| 98 |
+
"utterance_idx": utterance_id,
|
| 99 |
+
"context": context,
|
| 100 |
+
"speaker_idx": speaker_id,
|
| 101 |
+
"conv_id": conv_id,
|
| 102 |
+
"selfeval": selfeval,
|
| 103 |
+
"prompt": prompt,
|
| 104 |
+
"tags": tags,
|
| 105 |
+
}
|
| 106 |
+
break
|