Commit
•
27b0027
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
- fquad.py +109 -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": "FQuAD: French Question Answering Dataset\nWe introduce FQuAD, a native French Question Answering Dataset. FQuAD contains 25,000+ question and answer pairs.\nFinetuning CamemBERT on FQuAD yields a F1 score of 88% and an exact match of 77.9%.\n\n", "citation": "@ARTICLE{2020arXiv200206071\n author = {Martin, d'Hoffschmidt and Maxime, Vidal and\n Wacim, Belblidia and Tom, Brendl\u00e9},\n title = \"{FQuAD: French Question Answering Dataset}\",\n journal = {arXiv e-prints},\n keywords = {Computer Science - Computation and Language},\n year = \"2020\",\n month = \"Feb\",\n eid = {arXiv:2002.06071},\n pages = {arXiv:2002.06071},\narchivePrefix = {arXiv},\n eprint = {2002.06071},\n primaryClass = {cs.CL}\n}\n", "homepage": "https://fquad.illuin.tech/", "license": "", "features": {"context": {"dtype": "string", "id": null, "_type": "Value"}, "questions": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "answers": {"feature": {"texts": {"dtype": "string", "id": null, "_type": "Value"}, "answers_starts": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "fquad", "config_name": "default", "version": {"version_str": "0.1.0", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 5910248, "num_examples": 4921, "dataset_name": "fquad"}, "validation": {"name": "validation", "num_bytes": 1033253, "num_examples": 768, "dataset_name": "fquad"}}, "download_checksums": {"https://storage.googleapis.com/illuin/fquad/train.json.zip": {"num_bytes": 2813123, "checksum": "64f0aea68bacee6ffca7f2f7d56a97e504b2ad2abce057ab6c14768a72c09b47"}, "https://storage.googleapis.com/illuin/fquad/valid.json.zip": {"num_bytes": 479113, "checksum": "53eb7f33573f619f6d56f9e656c6ea6030639ebd663bb445b86b999123be1ef3"}}, "download_size": 3292236, "dataset_size": 6943501, "size_in_bytes": 10235737}}
|
dummy/0.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e3cbda7105c329d43952fea07a739e9d27b739bb0f26867e792e9bcd6f26d7fb
|
3 |
+
size 6764
|
fquad.py
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""TODO(fquad): Add a description here."""
|
2 |
+
|
3 |
+
from __future__ import absolute_import, division, print_function
|
4 |
+
|
5 |
+
import json
|
6 |
+
import os
|
7 |
+
|
8 |
+
import datasets
|
9 |
+
|
10 |
+
|
11 |
+
# TODO(fquad): BibTeX citation
|
12 |
+
_CITATION = """\
|
13 |
+
@ARTICLE{2020arXiv200206071
|
14 |
+
author = {Martin, d'Hoffschmidt and Maxime, Vidal and
|
15 |
+
Wacim, Belblidia and Tom, Brendlé},
|
16 |
+
title = "{FQuAD: French Question Answering Dataset}",
|
17 |
+
journal = {arXiv e-prints},
|
18 |
+
keywords = {Computer Science - Computation and Language},
|
19 |
+
year = "2020",
|
20 |
+
month = "Feb",
|
21 |
+
eid = {arXiv:2002.06071},
|
22 |
+
pages = {arXiv:2002.06071},
|
23 |
+
archivePrefix = {arXiv},
|
24 |
+
eprint = {2002.06071},
|
25 |
+
primaryClass = {cs.CL}
|
26 |
+
}
|
27 |
+
"""
|
28 |
+
|
29 |
+
# TODO(fquad):
|
30 |
+
_DESCRIPTION = """\
|
31 |
+
FQuAD: French Question Answering Dataset
|
32 |
+
We introduce FQuAD, a native French Question Answering Dataset. FQuAD contains 25,000+ question and answer pairs.
|
33 |
+
Finetuning CamemBERT on FQuAD yields a F1 score of 88% and an exact match of 77.9%.
|
34 |
+
|
35 |
+
"""
|
36 |
+
_URL = "https://storage.googleapis.com/illuin/fquad"
|
37 |
+
_TRAIN_DATA = "train.json.zip"
|
38 |
+
_VALID_DATA = "valid.json.zip"
|
39 |
+
|
40 |
+
|
41 |
+
class Fquad(datasets.GeneratorBasedBuilder):
|
42 |
+
"""TODO(fquad): Short description of my dataset."""
|
43 |
+
|
44 |
+
# TODO(fquad): Set up version.
|
45 |
+
VERSION = datasets.Version("0.1.0")
|
46 |
+
|
47 |
+
def _info(self):
|
48 |
+
# TODO(fquad): Specifies the datasets.DatasetInfo object
|
49 |
+
return datasets.DatasetInfo(
|
50 |
+
# This is the description that will appear on the datasets page.
|
51 |
+
description=_DESCRIPTION,
|
52 |
+
# datasets.features.FeatureConnectors
|
53 |
+
features=datasets.Features(
|
54 |
+
{
|
55 |
+
"context": datasets.Value("string"),
|
56 |
+
"questions": datasets.features.Sequence(datasets.Value("string")),
|
57 |
+
"answers": datasets.features.Sequence(
|
58 |
+
{"texts": datasets.Value("string"), "answers_starts": datasets.Value("int32")}
|
59 |
+
),
|
60 |
+
# These are the features of your dataset like images, labels ...
|
61 |
+
}
|
62 |
+
),
|
63 |
+
# If there's a common (input, target) tuple from the features,
|
64 |
+
# specify them here. They'll be used if as_supervised=True in
|
65 |
+
# builder.as_dataset.
|
66 |
+
supervised_keys=None,
|
67 |
+
# Homepage of the dataset for documentation
|
68 |
+
homepage="https://fquad.illuin.tech/",
|
69 |
+
citation=_CITATION,
|
70 |
+
)
|
71 |
+
|
72 |
+
def _split_generators(self, dl_manager):
|
73 |
+
"""Returns SplitGenerators."""
|
74 |
+
# TODO(fquad): Downloads the data and defines the splits
|
75 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to
|
76 |
+
# download and extract URLs
|
77 |
+
download_urls = {"train": os.path.join(_URL, _TRAIN_DATA), "valid": os.path.join(_URL, _VALID_DATA)}
|
78 |
+
dl_dir = dl_manager.download_and_extract(download_urls)
|
79 |
+
return [
|
80 |
+
datasets.SplitGenerator(
|
81 |
+
name=datasets.Split.TRAIN,
|
82 |
+
# These kwargs will be passed to _generate_examples
|
83 |
+
gen_kwargs={"filepath": os.path.join(dl_dir["train"], "train.json")},
|
84 |
+
),
|
85 |
+
datasets.SplitGenerator(
|
86 |
+
name=datasets.Split.VALIDATION,
|
87 |
+
# These kwargs will be passed to _generate_examples
|
88 |
+
gen_kwargs={"filepath": os.path.join(dl_dir["valid"], "valid.json")},
|
89 |
+
),
|
90 |
+
]
|
91 |
+
|
92 |
+
def _generate_examples(self, filepath):
|
93 |
+
|
94 |
+
"""Yields examples."""
|
95 |
+
# TODO(fquad): Yields (key, example) tuples from the dataset
|
96 |
+
with open(filepath, encoding="utf-8") as f:
|
97 |
+
data = json.load(f)
|
98 |
+
for id1, examples in enumerate(data["data"]):
|
99 |
+
for id2, example in enumerate(examples["paragraphs"]):
|
100 |
+
questions = [question["question"] for question in example["qas"]]
|
101 |
+
answers = [answer["answers"] for answer in example["qas"]]
|
102 |
+
texts = [answer[0]["text"] for answer in answers]
|
103 |
+
answers_starts = [answer[0]["answer_start"] for answer in answers]
|
104 |
+
|
105 |
+
yield str(id1) + "_" + str(id2), {
|
106 |
+
"context": example["context"],
|
107 |
+
"questions": questions,
|
108 |
+
"answers": {"texts": texts, "answers_starts": answers_starts},
|
109 |
+
}
|