parquet-converter commited on
Commit
33287d3
1 Parent(s): 6dfdf69

Update parquet files

Browse files
.gitattributes CHANGED
@@ -14,3 +14,4 @@
14
  *.pb filter=lfs diff=lfs merge=lfs -text
15
  *.pt filter=lfs diff=lfs merge=lfs -text
16
  *.pth filter=lfs diff=lfs merge=lfs -text
 
 
14
  *.pb filter=lfs diff=lfs merge=lfs -text
15
  *.pt filter=lfs diff=lfs merge=lfs -text
16
  *.pth filter=lfs diff=lfs merge=lfs -text
17
+ enro/wmt16-en-ro-pre-processed-train.parquet filter=lfs diff=lfs merge=lfs -text
README.md DELETED
@@ -1,19 +0,0 @@
1
- # WMT16 English-Romanian Translation Data w/ further preprocessing
2
-
3
- The original instructions are [here](https://github.com/rsennrich/wmt16-scripts/tree/master/sample).
4
-
5
- This pre-processed dataset was created by running:
6
-
7
- ```
8
- git clone https://github.com/rsennrich/wmt16-scripts
9
- cd wmt16-scripts
10
- cd sample
11
- ./download_files.sh
12
- ./preprocess.sh
13
- ```
14
-
15
- It was originally used by `transformers` [`finetune_trainer.py`](https://github.com/huggingface/transformers/blob/641f418e102218c4bf16fcd3124bfebed6217ef6/examples/seq2seq/finetune_trainer.py)
16
-
17
- The data itself resides at https://cdn-datasets.huggingface.co/translation/wmt_en_ro.tar.gz
18
-
19
- If you would like to convert it to jsonlines I've included a small script `convert-to-jsonlines.py` that will do it for you. But if you're using the `datasets` API, it will be done on the fly.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
convert-to-jsonlines.py DELETED
@@ -1,22 +0,0 @@
1
- #!/usr/bin/env python
2
-
3
- # sacrebleu format to jsonlines
4
-
5
- import io
6
- import json
7
- import re
8
-
9
- src_lang, tgt_lang = ["en", "ro"]
10
-
11
- for split in ["train", "val", "test"]:
12
- recs = []
13
- fout = f"{split}.json"
14
- with io.open(fout, "w", encoding="utf-8") as f:
15
- for type in ["source", "target"]:
16
- fin = f"{split}.{type}"
17
- recs.append([line.strip() for line in open(fin)])
18
- for src, tgt in zip(*recs):
19
- out = {"translation": { src_lang: src, tgt_lang: tgt } }
20
- x = json.dumps(out, indent=0, ensure_ascii=False)
21
- x = re.sub(r'\n', ' ', x, 0, re.M)
22
- f.write(x + "\n")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dataset_infos.json DELETED
@@ -1 +0,0 @@
1
- {"enro": {"description": "WMT16 English-Romanian Translation Data with further preprocessing", "citation": "@InProceedings{huggingface:dataset,\ntitle = {WMT16 English-Romanian Translation Data with further preprocessing},\nauthors={},\nyear={2016}\n}\n", "homepage": "http://www.statmt.org/wmt16/", "license": "", "features": {"translation": {"languages": ["en", "ro"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "en", "output": "ro"}, "builder_name": "wmt16_en_ro_pre_processed", "config_name": "enro", "version": {"version_str": "1.1.0", "description": "", "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 188288211, "num_examples": 610320, "dataset_name": "wmt16_en_ro_pre_processed"}, "validation": {"name": "validation", "num_bytes": 561799, "num_examples": 1999, "dataset_name": "wmt16_en_ro_pre_processed"}, "test": {"name": "test", "num_bytes": 539216, "num_examples": 1999, "dataset_name": "wmt16_en_ro_pre_processed"}}, "download_checksums": {"https://cdn-datasets.huggingface.co/translation/wmt_en_ro.tar.gz": {"num_bytes": 60043891, "checksum": "1f78fae1faac609a0b32ce0ea4bf9b01a5a4e60354207e2071535acca3275af7"}}, "download_size": 60043891, "post_processing_size": null, "dataset_size": 189389226, "size_in_bytes": 249433117}}
 
 
enro/wmt16-en-ro-pre-processed-test.parquet ADDED
Binary file (342 kB). View file
 
enro/wmt16-en-ro-pre-processed-train.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3953f62e6f4e9fdf91d0ec36482499263cc3a7499fcb700257b05db485d7dd6
3
+ size 107880299
enro/wmt16-en-ro-pre-processed-validation.parquet ADDED
Binary file (362 kB). View file
 
wmt16-en-ro-pre-processed.py DELETED
@@ -1,133 +0,0 @@
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
- """ WMT16 English-Romanian Translation Data with further preprocessing """
16
-
17
- from __future__ import absolute_import, division, print_function
18
-
19
- import csv
20
- import json
21
- import os
22
-
23
- import datasets
24
-
25
- _CITATION = """\
26
- @InProceedings{huggingface:dataset,
27
- title = {WMT16 English-Romanian Translation Data with further preprocessing},
28
- authors={},
29
- year={2016}
30
- }
31
- """
32
-
33
- _DESCRIPTION = "WMT16 English-Romanian Translation Data with further preprocessing"
34
- _HOMEPAGE = "http://www.statmt.org/wmt16/"
35
- _LICENSE = ""
36
-
37
-
38
- _DATA_URL = "https://cdn-datasets.huggingface.co/translation/wmt_en_ro.tar.gz"
39
-
40
-
41
- class Wmt16EnRoPreProcessedConfig(datasets.BuilderConfig):
42
- """BuilderConfig for wmt16."""
43
-
44
- def __init__(self, language_pair=(None, None), **kwargs):
45
- """BuilderConfig for wmt16
46
-
47
- Args:
48
- for the `datasets.features.text.TextEncoder` used for the features feature.
49
- language_pair: pair of languages that will be used for translation. Should
50
- contain 2-letter coded strings. First will be used at source and second
51
- as target in supervised mode. For example: ("se", "en").
52
- **kwargs: keyword arguments forwarded to super.
53
- """
54
- name = "%s%s" % (language_pair[0], language_pair[1])
55
-
56
- description = ("Translation dataset from %s to %s") % (language_pair[0], language_pair[1])
57
- super(Wmt16EnRoPreProcessedConfig, self).__init__(
58
- name=name,
59
- description=description,
60
- version=datasets.Version("1.1.0", ""),
61
- **kwargs,
62
- )
63
-
64
- # Validate language pair.
65
- assert "en" in language_pair, ("Config language pair must contain `en`, got: %s", language_pair)
66
- source, target = language_pair
67
- non_en = source if target == "en" else target
68
- assert non_en in ["ro"], ("Invalid non-en language in pair: %s", non_en)
69
-
70
- self.language_pair = language_pair
71
-
72
-
73
- # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
74
- class Wmt16EnRoPreProcessed(datasets.GeneratorBasedBuilder):
75
-
76
- BUILDER_CONFIGS = [
77
- Wmt16EnRoPreProcessedConfig(
78
- language_pair=("en", "ro"),
79
- ),
80
- ]
81
-
82
- def _info(self):
83
- source, target = self.config.language_pair
84
- return datasets.DatasetInfo(
85
- description=_DESCRIPTION,
86
- features=datasets.Features(
87
- {"translation": datasets.features.Translation(languages=self.config.language_pair)}
88
- ),
89
- supervised_keys=(source, target),
90
- homepage=_HOMEPAGE,
91
- citation=_CITATION,
92
- )
93
-
94
- def _split_generators(self, dl_manager):
95
- dl_dir = dl_manager.download_and_extract(_DATA_URL)
96
-
97
- source, target = self.config.language_pair
98
- non_en = source if target == "en" else target
99
- path_tmpl = "{dl_dir}/wmt_en_ro/{split}.{type}"
100
-
101
- files = {}
102
- for split in ("train", "val", "test"):
103
- files[split] = {
104
- "source_file": path_tmpl.format(dl_dir=dl_dir, split=split, type="source"),
105
- "target_file": path_tmpl.format(dl_dir=dl_dir, split=split, type="target"),
106
- }
107
-
108
- return [
109
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs=files["train"]),
110
- datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs=files["val"]),
111
- datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs=files["test"]),
112
- ]
113
-
114
- def _generate_examples(self, source_file, target_file):
115
- """This function returns the examples in the raw (text) form."""
116
- with open(source_file, encoding="utf-8") as f:
117
- source_sentences = f.read().split("\n")
118
- with open(target_file, encoding="utf-8") as f:
119
- target_sentences = f.read().split("\n")
120
-
121
- assert len(target_sentences) == len(source_sentences), "Sizes do not match: %d vs %d for %s vs %s." % (
122
- len(source_sentences),
123
- len(target_sentences),
124
- source_file,
125
- target_file,
126
- )
127
-
128
- source, target = self.config.language_pair
129
- for idx, (l1, l2) in enumerate(zip(source_sentences, target_sentences)):
130
- result = {"translation": {source: l1, target: l2}}
131
- # Make sure that both translations are non-empty.
132
- if all(result.values()):
133
- yield idx, result