Datasets:
Commit
·
e8e2129
0
Parent(s):
Update files from the datasets library (from 1.0.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.0.0
- .gitattributes +27 -0
- dataset_infos.json +1 -0
- dummy/0.1.0/dummy_data.zip +3 -0
- empathetic_dialogues.py +108 -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
|
dataset_infos.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"default": {"description": "PyTorch original implementation of Towards Empathetic Open-domain Conversation Models: a New Benchmark and Dataset\n", "citation": "@inproceedings{rashkin2019towards,\n title = {Towards Empathetic Open-domain Conversation Models: a New Benchmark and Dataset},\n author = {Hannah Rashkin and Eric Michael Smith and Margaret Li and Y-Lan Boureau},\n booktitle = {ACL},\n year = {2019},\n}\n", "homepage": "https://github.com/facebookresearch/EmpatheticDialogues", "license": "", "features": {"conv_id": {"dtype": "string", "id": null, "_type": "Value"}, "utterance_idx": {"dtype": "int32", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "prompt": {"dtype": "string", "id": null, "_type": "Value"}, "speaker_idx": {"dtype": "int32", "id": null, "_type": "Value"}, "utterance": {"dtype": "string", "id": null, "_type": "Value"}, "selfeval": {"dtype": "string", "id": null, "_type": "Value"}, "tags": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "empathetic_dialogues", "config_name": "default", "version": {"version_str": "0.1.0", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 3011332, "num_examples": 10943, "dataset_name": "empathetic_dialogues"}, "train": {"name": "train", "num_bytes": 19040509, "num_examples": 76673, "dataset_name": "empathetic_dialogues"}, "validation": {"name": "validation", "num_bytes": 3077481, "num_examples": 12030, "dataset_name": "empathetic_dialogues"}}, "download_checksums": {"https://dl.fbaipublicfiles.com/parlai/empatheticdialogues/empatheticdialogues.tar.gz": {"num_bytes": 28022709, "checksum": "56f234d77b7dd1f005fd365bb17769cfe346c3c84295b69bc069c8ccb83be03d"}}, "download_size": 28022709, "dataset_size": 25129322, "size_in_bytes": 53152031}}
|
dummy/0.1.0/dummy_data.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:236f42ae807d4795c7569fd0cb5e22614d5da4c292bbe859c6077c226fc01772
|
| 3 |
+
size 1800
|
empathetic_dialogues.py
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""TODO(empathetic_dialogues): Add a description here."""
|
| 2 |
+
|
| 3 |
+
from __future__ import absolute_import, division, print_function
|
| 4 |
+
|
| 5 |
+
import csv
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
+
import datasets
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
_CITATION = """\
|
| 12 |
+
@inproceedings{rashkin2019towards,
|
| 13 |
+
title = {Towards Empathetic Open-domain Conversation Models: a New Benchmark and Dataset},
|
| 14 |
+
author = {Hannah Rashkin and Eric Michael Smith and Margaret Li and Y-Lan Boureau},
|
| 15 |
+
booktitle = {ACL},
|
| 16 |
+
year = {2019},
|
| 17 |
+
}
|
| 18 |
+
"""
|
| 19 |
+
|
| 20 |
+
_DESCRIPTION = """\
|
| 21 |
+
PyTorch original implementation of Towards Empathetic Open-domain Conversation Models: a New Benchmark and Dataset
|
| 22 |
+
"""
|
| 23 |
+
_URL = "https://dl.fbaipublicfiles.com/parlai/empatheticdialogues/empatheticdialogues.tar.gz"
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
class EmpatheticDialogues(datasets.GeneratorBasedBuilder):
|
| 27 |
+
"""TODO(empathetic_dialogues): Short description of my dataset."""
|
| 28 |
+
|
| 29 |
+
# TODO(empathetic_dialogues): Set up version.
|
| 30 |
+
VERSION = datasets.Version("0.1.0")
|
| 31 |
+
|
| 32 |
+
def _info(self):
|
| 33 |
+
# TODO(empathetic_dialogues): Specifies the datasets.DatasetInfo object
|
| 34 |
+
return datasets.DatasetInfo(
|
| 35 |
+
# This is the description that will appear on the datasets page.
|
| 36 |
+
description=_DESCRIPTION,
|
| 37 |
+
# datasets.features.FeatureConnectors
|
| 38 |
+
features=datasets.Features(
|
| 39 |
+
{
|
| 40 |
+
"conv_id": datasets.Value("string"),
|
| 41 |
+
"utterance_idx": datasets.Value("int32"),
|
| 42 |
+
"context": datasets.Value("string"),
|
| 43 |
+
"prompt": datasets.Value("string"),
|
| 44 |
+
"speaker_idx": datasets.Value("int32"),
|
| 45 |
+
"utterance": datasets.Value("string"),
|
| 46 |
+
"selfeval": datasets.Value("string"),
|
| 47 |
+
"tags": datasets.Value("string")
|
| 48 |
+
# These are the features of your dataset like images, labels ...
|
| 49 |
+
}
|
| 50 |
+
),
|
| 51 |
+
# If there's a common (input, target) tuple from the features,
|
| 52 |
+
# specify them here. They'll be used if as_supervised=True in
|
| 53 |
+
# builder.as_dataset.
|
| 54 |
+
supervised_keys=None,
|
| 55 |
+
# Homepage of the dataset for documentation
|
| 56 |
+
homepage="https://github.com/facebookresearch/EmpatheticDialogues",
|
| 57 |
+
citation=_CITATION,
|
| 58 |
+
)
|
| 59 |
+
|
| 60 |
+
def _split_generators(self, dl_manager):
|
| 61 |
+
"""Returns SplitGenerators."""
|
| 62 |
+
# TODO(empathetic_dialogues): Downloads the data and defines the splits
|
| 63 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to
|
| 64 |
+
# download and extract URLs
|
| 65 |
+
dl_dir = dl_manager.download_and_extract(_URL)
|
| 66 |
+
data_dir = os.path.join(dl_dir, "empatheticdialogues")
|
| 67 |
+
return [
|
| 68 |
+
datasets.SplitGenerator(
|
| 69 |
+
name=datasets.Split.TRAIN,
|
| 70 |
+
# These kwargs will be passed to _generate_examples
|
| 71 |
+
gen_kwargs={"filepath": os.path.join(data_dir, "train.csv")},
|
| 72 |
+
),
|
| 73 |
+
datasets.SplitGenerator(
|
| 74 |
+
name=datasets.Split.VALIDATION,
|
| 75 |
+
# These kwargs will be passed to _generate_examples
|
| 76 |
+
gen_kwargs={"filepath": os.path.join(data_dir, "valid.csv")},
|
| 77 |
+
),
|
| 78 |
+
datasets.SplitGenerator(
|
| 79 |
+
name=datasets.Split.TEST,
|
| 80 |
+
# These kwargs will be passed to _generate_examples
|
| 81 |
+
gen_kwargs={"filepath": os.path.join(data_dir, "test.csv")},
|
| 82 |
+
),
|
| 83 |
+
]
|
| 84 |
+
|
| 85 |
+
def _generate_examples(self, filepath):
|
| 86 |
+
"""Yields examples."""
|
| 87 |
+
# TODO(empathetic_dialogues): Yields (key, example) tuples from the dataset
|
| 88 |
+
with open(filepath, encoding="utf-8") as f:
|
| 89 |
+
data = csv.DictReader(f)
|
| 90 |
+
for id_, row in enumerate(data):
|
| 91 |
+
utterance = row["utterance"]
|
| 92 |
+
speaker_id = int(row["speaker_idx"])
|
| 93 |
+
context = row["context"]
|
| 94 |
+
conv_id = row["conv_id"]
|
| 95 |
+
tags = row["tags"] if row["tags"] else ""
|
| 96 |
+
selfeval = row["selfeval"] if row["selfeval"] else ""
|
| 97 |
+
utterance_id = int(row["utterance_idx"])
|
| 98 |
+
prompt = row["prompt"]
|
| 99 |
+
yield id_, {
|
| 100 |
+
"utterance": utterance,
|
| 101 |
+
"utterance_idx": utterance_id,
|
| 102 |
+
"context": context,
|
| 103 |
+
"speaker_idx": speaker_id,
|
| 104 |
+
"conv_id": conv_id,
|
| 105 |
+
"selfeval": selfeval,
|
| 106 |
+
"prompt": prompt,
|
| 107 |
+
"tags": tags,
|
| 108 |
+
}
|