import from S3
Browse files- README.md +173 -0
- de_head_0000_2015-48.tar.gz +3 -0
- de_head_0000_2016-18.tar.gz +3 -0
- german_common_crawl.py +153 -0
README.md
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
YAML tags:
|
3 |
+
- copy-paste the tags obtained with the tagging app: http://34.68.228.168:8501/
|
4 |
+
---
|
5 |
+
|
6 |
+
# Dataset Card for GermanCommonCrawl
|
7 |
+
|
8 |
+
## Table of Contents
|
9 |
+
- [Dataset Description](#dataset-description)
|
10 |
+
- [Dataset Summary](#dataset-summary)
|
11 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
12 |
+
- [Languages](#languages)
|
13 |
+
- [Dataset Structure](#dataset-structure)
|
14 |
+
- [Data Instances](#data-instances)
|
15 |
+
- [Data Fields](#data-instances)
|
16 |
+
- [Data Splits](#data-instances)
|
17 |
+
- [Dataset Creation](#dataset-creation)
|
18 |
+
- [Curation Rationale](#curation-rationale)
|
19 |
+
- [Source Data](#source-data)
|
20 |
+
- [Annotations](#annotations)
|
21 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
22 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
23 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
24 |
+
- [Discussion of Biases](#discussion-of-biases)
|
25 |
+
- [Other Known Limitations](#other-known-limitations)
|
26 |
+
- [Additional Information](#additional-information)
|
27 |
+
- [Dataset Curators](#dataset-curators)
|
28 |
+
- [Licensing Information](#licensing-information)
|
29 |
+
- [Citation Information](#citation-information)
|
30 |
+
|
31 |
+
## Dataset Description
|
32 |
+
|
33 |
+
- **Homepage:**
|
34 |
+
- **Repository:** https://github.com/German-NLP-Group/german-transformer-training
|
35 |
+
- **Paper:**
|
36 |
+
- **Leaderboard:**
|
37 |
+
- **Point of Contact:** philipp.reissel@rwth-aachen.de
|
38 |
+
|
39 |
+
### Dataset Summary
|
40 |
+
|
41 |
+
German Only Extract from Common Crawl
|
42 |
+
|
43 |
+
Stats:
|
44 |
+
|
45 |
+
Total Size after Deduplication: 142 Mio Pages / 194 GB (Gzipped)
|
46 |
+
Total Size before Deduplcation: 263 Mio Pages / 392 GB (Gzipped)
|
47 |
+
|
48 |
+
|
49 |
+
### Supported Tasks and Leaderboards
|
50 |
+
|
51 |
+
This Dataset is for pretraining a German Language Model (Unsupervised).
|
52 |
+
|
53 |
+
### Languages
|
54 |
+
|
55 |
+
German only (Sometimes websites are partially in another Language). One can filter these out through the `language_score` attribute.
|
56 |
+
|
57 |
+
## Dataset Structure
|
58 |
+
|
59 |
+
### Data Instances
|
60 |
+
|
61 |
+
```
|
62 |
+
{'url': 'http://my-shop.ru/shop/books/545473.html',
|
63 |
+
'date_download': '2016-10-20T19:38:58Z',
|
64 |
+
'digest': 'sha1:F62EMGYLZDIKF4UL5JZYU47KWGGUBT7T',
|
65 |
+
'length': 1155,
|
66 |
+
'nlines': 4,
|
67 |
+
'source_domain': 'my-shop.ru',
|
68 |
+
'title': 'Grammatikalische Liebeslieder. Methodische Vorschläge',
|
69 |
+
'raw_content': 'Grammatikalische Liebeslieder. [....]',
|
70 |
+
'cc_segment': 'crawl-data/CC-MAIN-2016-44/segments/1476988717783.68/wet/CC-MAIN-20161020183837-00354-ip-10-171-6-4.ec2.internal.warc.wet.gz',
|
71 |
+
'original_nlines': 99,
|
72 |
+
'original_length': 2672,
|
73 |
+
'language': 'de',
|
74 |
+
'language_score': 1.0,
|
75 |
+
'perplexity': 283.0,
|
76 |
+
'bucket': 'head'}"
|
77 |
+
```
|
78 |
+
|
79 |
+
### Data Fields
|
80 |
+
|
81 |
+
|
82 |
+
### Data Splits
|
83 |
+
|
84 |
+
Train only
|
85 |
+
|
86 |
+
## Dataset Creation
|
87 |
+
|
88 |
+
### Curation Rationale
|
89 |
+
|
90 |
+
Handling and Filtering of Common Crawl Data requires large scale Server Ressources at a location in the US (for downloading speed). The total computing time needed to create this dataset is above 100k CPU hours. To give others the opportunity to train models with this dataset easily we make it publicly available.
|
91 |
+
|
92 |
+
In most use cases you see an improved Model Performance when extending the pre-training Data so one can achieve highest accuracies as this is probably the largest available dataset.
|
93 |
+
|
94 |
+
|
95 |
+
### Source Data
|
96 |
+
|
97 |
+
It was filtered from the Common Crawl Snapshots of the following months:
|
98 |
+
|
99 |
+
1. 2015-48
|
100 |
+
2. 2016-18
|
101 |
+
3. 2016-44
|
102 |
+
4. 2017-33
|
103 |
+
5. 2017-30
|
104 |
+
6. 2017-30
|
105 |
+
7. 2017-39
|
106 |
+
8. 2017-51
|
107 |
+
9. 2018-09
|
108 |
+
10. 2018-17
|
109 |
+
11. 2018-30
|
110 |
+
12. 2018-39
|
111 |
+
13. 2018-51
|
112 |
+
14. 2019-09
|
113 |
+
15. 2019-18
|
114 |
+
16. 2019-30
|
115 |
+
17. 2019-47
|
116 |
+
18. 2020-10
|
117 |
+
|
118 |
+
#### Initial Data Collection and Normalization
|
119 |
+
|
120 |
+
Filtering and deduplication of each month seperalety was performed with [CC_Net](https://github.com/facebookresearch/cc_net). The current datasets only contains the best part (head part) with the highest text quality (see CC_Net Paper for more details). Middle and tail part may be uploaded soon as well, or are available on request.
|
121 |
+
|
122 |
+
Afterwards this Dataset was deduplicated again to filter out Websites which occur in multiple monthly snapshots. This deduplication removes all Websites which have either the same url or the same hash (this is to filter out websites which are accessible under multiple domains)
|
123 |
+
|
124 |
+
#### Who are the source language producers?
|
125 |
+
|
126 |
+
[More Information Needed]
|
127 |
+
|
128 |
+
### Annotations
|
129 |
+
|
130 |
+
#### Annotation process
|
131 |
+
|
132 |
+
[More Information Needed]
|
133 |
+
|
134 |
+
#### Who are the annotators?
|
135 |
+
|
136 |
+
[More Information Needed]
|
137 |
+
|
138 |
+
### Personal and Sensitive Information
|
139 |
+
|
140 |
+
[More Information Needed]
|
141 |
+
|
142 |
+
## Considerations for Using the Data
|
143 |
+
|
144 |
+
### Social Impact of Dataset
|
145 |
+
|
146 |
+
[More Information Needed]
|
147 |
+
|
148 |
+
### Discussion of Biases
|
149 |
+
|
150 |
+
[More Information Needed]
|
151 |
+
|
152 |
+
### Other Known Limitations
|
153 |
+
|
154 |
+
|
155 |
+
## Additional Information
|
156 |
+
|
157 |
+
### Dataset Curators
|
158 |
+
|
159 |
+
[More Information Needed]
|
160 |
+
|
161 |
+
### Licensing Information
|
162 |
+
|
163 |
+
[More Information Needed]
|
164 |
+
|
165 |
+
### Citation Information
|
166 |
+
```
|
167 |
+
@inproceedings{wenzek2020ccnet,
|
168 |
+
title={CCNet: Extracting High Quality Monolingual Datasets from Web Crawl Data},
|
169 |
+
author={Wenzek, Guillaume and Lachaux, Marie-Anne and Conneau, Alexis and Chaudhary, Vishrav and Guzm{\'a}n, Francisco and Joulin, Armand and Grave, {\'E}douard},
|
170 |
+
booktitle={Proceedings of The 12th Language Resources and Evaluation Conference},
|
171 |
+
pages={4003--4012},
|
172 |
+
year={2020}
|
173 |
+
```
|
de_head_0000_2015-48.tar.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:de4ca886d66be678f88967812cc0e52c43392676487da0434d471431131e54ca
|
3 |
+
size 1226773504
|
de_head_0000_2016-18.tar.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4bf70f415610188201036107205033d443af15209f929f648b93420d5c996144
|
3 |
+
size 1564410794
|
german_common_crawl.py
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""German Common Crawl"""
|
16 |
+
|
17 |
+
from __future__ import absolute_import, division, print_function
|
18 |
+
|
19 |
+
import csv
|
20 |
+
import json
|
21 |
+
import os
|
22 |
+
import gzip
|
23 |
+
|
24 |
+
import datasets
|
25 |
+
|
26 |
+
|
27 |
+
# Find for instance the citation on arxiv or on the dataset repo/website
|
28 |
+
_CITATION = """\
|
29 |
+
@inproceedings{wenzek2020ccnet,
|
30 |
+
title={CCNet: Extracting High Quality Monolingual Datasets from Web Crawl Data},
|
31 |
+
author={Wenzek, Guillaume and Lachaux, Marie-Anne and Conneau, Alexis and Chaudhary, Vishrav and Guzm{\'a}n, Francisco and Joulin, Armand and Grave, {\'E}douard},
|
32 |
+
booktitle={Proceedings of The 12th Language Resources and Evaluation Conference},
|
33 |
+
pages={4003--4012},
|
34 |
+
year={2020}
|
35 |
+
}
|
36 |
+
"""
|
37 |
+
|
38 |
+
_DESCRIPTION = """\
|
39 |
+
German Only Extract from Common Crawl
|
40 |
+
|
41 |
+
This Dataset is for pretraining a German Language Model (Unsupervised) or tune a Multilingual Model specifically to German
|
42 |
+
"""
|
43 |
+
|
44 |
+
|
45 |
+
_URL = ["https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/german-nlp-group/german_common_crawl/de_head_0000_2015-48.tar.gz"]
|
46 |
+
|
47 |
+
|
48 |
+
class GermanCommonCrawl(datasets.GeneratorBasedBuilder):
|
49 |
+
"""TODO: Short description of my dataset."""
|
50 |
+
|
51 |
+
VERSION = datasets.Version("1.1.0")
|
52 |
+
|
53 |
+
|
54 |
+
BUILDER_CONFIGS = [
|
55 |
+
datasets.BuilderConfig(name="first_part", version=VERSION, description="Download only one part (2 GB) instead of everythong (200 GB)"),
|
56 |
+
datasets.BuilderConfig(name="data_only", version=VERSION, description="Only the website text without metadata"),
|
57 |
+
datasets.BuilderConfig(name="metadata", version=VERSION, description="Metadata and raw text"),
|
58 |
+
]
|
59 |
+
|
60 |
+
DEFAULT_CONFIG_NAME = "metadata"
|
61 |
+
|
62 |
+
def _info(self):
|
63 |
+
if self.config.name == "data_only": # This is the name of the configuration selected in BUILDER_CONFIGS above
|
64 |
+
features = datasets.Features(
|
65 |
+
{
|
66 |
+
"raw_content": datasets.Value("string"),
|
67 |
+
}
|
68 |
+
)
|
69 |
+
else: # This is an example to show how to have different features for "first_domain" and "second_domain"
|
70 |
+
features = datasets.Features(
|
71 |
+
{
|
72 |
+
"text": datasets.Value("string"),
|
73 |
+
"url": datasets.Value("string"),
|
74 |
+
"digest": datasets.Value("string"),
|
75 |
+
"length": datasets.Value("int32"),
|
76 |
+
"nlines": datasets.Value("int32"),
|
77 |
+
"source_domain": datasets.Value("string"),
|
78 |
+
"title": datasets.Value("string"),
|
79 |
+
"raw_content": datasets.Value("string"),
|
80 |
+
"cc_segment": datasets.Value("string"),
|
81 |
+
"original_nlines": datasets.Value("int32"),
|
82 |
+
"original_length": datasets.Value("int32"),
|
83 |
+
"language": datasets.Value("string"),
|
84 |
+
"perplexity": datasets.Value("int32"),
|
85 |
+
"bucket": datasets.Value("int32"),
|
86 |
+
|
87 |
+
}
|
88 |
+
)
|
89 |
+
return datasets.DatasetInfo(
|
90 |
+
# This is the description that will appear on the datasets page.
|
91 |
+
description=_DESCRIPTION,
|
92 |
+
# This defines the different columns of the dataset and their types
|
93 |
+
features=features, # Here we define them above because they are different between the two configurations
|
94 |
+
# If there's a common (input, target) tuple from the features,
|
95 |
+
# specify them here. They'll be used if as_supervised=True in
|
96 |
+
# builder.as_dataset.
|
97 |
+
supervised_keys=None,
|
98 |
+
# Citation for the dataset
|
99 |
+
citation=_CITATION,
|
100 |
+
)
|
101 |
+
|
102 |
+
def _split_generators(self, dl_manager):
|
103 |
+
"""Returns SplitGenerators."""
|
104 |
+
|
105 |
+
if self.config == "first_part":
|
106 |
+
data_dir = dl_manager.download_and_extract(_URL[0])
|
107 |
+
|
108 |
+
else:
|
109 |
+
data_dir = dl_manager.download_and_extract(_URL)
|
110 |
+
|
111 |
+
return [
|
112 |
+
datasets.SplitGenerator(
|
113 |
+
name=datasets.Split.TRAIN,
|
114 |
+
# These kwargs will be passed to _generate_examples
|
115 |
+
gen_kwargs={
|
116 |
+
"folderpath": data_dir,
|
117 |
+
"split": "train",
|
118 |
+
},
|
119 |
+
),
|
120 |
+
]
|
121 |
+
|
122 |
+
def _generate_examples(self, folderpath, split):
|
123 |
+
""" Yields examples. """
|
124 |
+
|
125 |
+
files = os.listdir(folderpath)
|
126 |
+
|
127 |
+
if self.config == "first_part":
|
128 |
+
files = os.path.join(folderpath, files[0])
|
129 |
+
else:
|
130 |
+
files = [os.path.join(folderpath, file) for file in files]
|
131 |
+
|
132 |
+
#filepath = "/media/data/48_BERT/22_HF_Dataset/Data/de_head_0000_2015-48.tar.gz"
|
133 |
+
|
134 |
+
for filepath in files:
|
135 |
+
with gzip.open(filepath, 'rt', encoding="utf-8") as f:
|
136 |
+
for id_, row in enumerate(f):
|
137 |
+
data = eval(row)
|
138 |
+
if self.config.name == "data_only":
|
139 |
+
yield id_, {
|
140 |
+
"raw_content": data["raw_content"],
|
141 |
+
}
|
142 |
+
else:
|
143 |
+
yield id_, data
|
144 |
+
|
145 |
+
|
146 |
+
|
147 |
+
|
148 |
+
|
149 |
+
|
150 |
+
|
151 |
+
|
152 |
+
|
153 |
+
|