CoolFace
Datasetpublic

allenai/c4

C4 Dataset Summary A colossal, cleaned version of Common Crawl's web crawl corpus. Based on Common Crawl dataset: "https://commoncrawl.org". This is the processed version of Google's C4 dataset We prepared five variants of the data: en, en.noclean, en.noblocklist, realnewslike, and multilingual (mC4). For reference, these are the sizes of the variants: en: 305GB en.noclean: 2.3TB en.noblocklist: 380GB realnewslike: 15GB multilingual (mC4): 9.7TB (108 subsets, one… See the full description on the dataset page: https://huggingface.co/datasets/allenai/c4.

sourceHugging Faceodc-byupdated 3y agoView on Hugging Face
671likes1.3mdownloads
Dataset Card

C4

Dataset Description

  • Paper: https://arxiv.org/abs/1910.10683

Dataset Summary

A colossal, cleaned version of Common Crawl's web crawl corpus. Based on Common Crawl dataset: "https://commoncrawl.org".

This is the processed version of Google's C4 dataset

We prepared five variants of the data: en, en.noclean, en.noblocklist, realnewslike, and multilingual (mC4).

For reference, these are the sizes of the variants:

  • en: 305GB
  • en.noclean: 2.3TB
  • en.noblocklist: 380GB
  • realnewslike: 15GB
  • multilingual (mC4): 9.7TB (108 subsets, one per language)

The en.noblocklist variant is exactly the same as the en variant, except we turned off the so-called "badwords filter", which removes all documents that contain words from the lists at https://github.com/LDNOOBW/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words.

How do I download this?
Using 🤗 Datasets
python
from datasets import load_dataset

# English only
en = load_dataset("allenai/c4", "en")

# Other variants in english
en_noclean = load_dataset("allenai/c4", "en.noclean")
en_noblocklist = load_dataset("allenai/c4", "en.noblocklist")
realnewslike = load_dataset("allenai/c4", "realnewslike")

# Multilingual (108 languages)
multilingual = load_dataset("allenai/c4", "multilingual")

# One specific language
es = load_dataset("allenai/c4", "es")

Since this dataset is big, it is encouraged to load it in streaming mode using streaming=True, for example:

python
en = load_dataset("allenai/c4", "en", streaming=True)

You can also load and mix multiple languages:

python
from datasets import concatenate_datasets, interleave_datasets, load_dataset

es = load_dataset("allenai/c4", "es", streaming=True)
fr = load_dataset("allenai/c4", "fr", streaming=True)

# Concatenate both datasets
concatenated = concatenate_datasets([es, fr])
# Or interleave them (alternates between one and the other)
interleaved = interleave_datasets([es, fr])
Using Dask
python
import dask.dataframe as dd

df = dd.read_json("hf://datasets/allenai/c4/en/c4-train.*.json.gz")

# English only
en_df = dd.read_json("hf://datasets/allenai/c4/en/c4-*.json.gz")

# Other variants in english
en_noclean_df = dd.read_json("hf://datasets/allenai/c4/en/noclean/c4-*.json.gz")
en_noblocklist_df = dd.read_json("hf://datasets/allenai/c4/en.noblocklist/c4-*.json.gz")
realnewslike_df = dd.read_json("hf://datasets/allenai/c4/realnewslike/c4-*.json.gz")

# Multilingual (108 languages)
multilingual_df = dd.read_json("hf://datasets/allenai/c4/multilingual/c4-*.json.gz")

# One specific language
es_train_df = dd.read_json("hf://datasets/allenai/c4/multilingual/c4-es.*.json.gz")
es_valid_df = dd.read_json("hf://datasets/allenai/c4/multilingual/c4-es-validation.*.json.gz")
Using Git
bash
git clone https://huggingface.co/datasets/allenai/c4

This will download 13TB to your local drive. If you want to be more precise with what you are downloading, follow these commands instead:

bash
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/datasets/allenai/c4
cd c4
git lfs pull --include "en/*"

The git clone command in this variant will download a bunch of stub files that Git LFS uses, so you can see all the filenames that exist that way. You can then convert the stubs into their real files with git lfs pull --include "...". For example, if you wanted all the Dutch documents from the multilingual set, you would run

bash
git lfs pull --include "multilingual/c4-nl.*.json.gz"

Supported Tasks and Leaderboards

C4 and mC4 are mainly intended to pretrain language models and word representations.

Languages

The en, en.noclean, en.noblocklist and realnewslike variants are in English.

The other 108 languages are available and are reported in the table below.

Note that the languages that end with "-Latn" are simply romanized variants, i.e. written using the Latin script.

language codelanguage name
afAfrikaans
amAmharic
arArabic
azAzerbaijani
beBelarusian
bgBulgarian
bg-LatnBulgarian (Latin)
bnBangla
caCatalan
cebCebuano
coCorsican
csCzech
cyWelsh
daDanish
deGerman
elGreek
el-LatnGreek (Latin)
enEnglish
eoEsperanto
esSpanish
etEstonian
euBasque
faPersian
fiFinnish
filFilipino
frFrench
fyWestern Frisian
gaIrish
gdScottish Gaelic
glGalician
guGujarati
haHausa
hawHawaiian
hiHindi
hi-LatnHindi (Latin script)
hmnHmong, Mong
htHaitian
huHungarian
hyArmenian
idIndonesian
igIgbo
isIcelandic
itItalian
iwformer Hebrew
jaJapanese
ja-LatnJapanese (Latin)
jvJavanese
kaGeorgian
kkKazakh
kmKhmer
knKannada
koKorean
kuKurdish
kyKyrgyz
laLatin
lbLuxembourgish
loLao
ltLithuanian
lvLatvian
mgMalagasy
miMaori
mkMacedonian
mlMalayalam
mnMongolian
mrMarathi
msMalay
mtMaltese
myBurmese
neNepali
nlDutch
noNorwegian
nyNyanja
paPunjabi
plPolish
psPashto
ptPortuguese
roRomanian
ruRussian
ru-LatnRussian (Latin)
sdSindhi
siSinhala
skSlovak
slSlovenian
smSamoan
snShona
soSomali
sqAlbanian
srSerbian
stSouthern Sotho
suSundanese
svSwedish
swSwahili
taTamil
teTelugu
tgTajik
thThai
trTurkish
ukUkrainian
undUnknown language
urUrdu
uzUzbek
viVietnamese
xhXhosa
yiYiddish
yoYoruba
zhChinese
zh-LatnChinese (Latin)
zuZulu

Dataset Structure

Data Instances

An example form the en config is:

{
  'url': 'https://klyq.com/beginners-bbq-class-taking-place-in-missoula/',
  'text': 'Beginners BBQ Class Taking Place in Missoula!\nDo you want to get better at making delicious BBQ? You will have the opportunity, put this on your calendar now. Thursday, September 22nd join World Class BBQ Champion, Tony Balay from Lonestar Smoke Rangers. He will be teaching a beginner level class for everyone who wants to get better with their culinary skills.\nHe will teach you everything you need to know to compete in a KCBS BBQ competition, including techniques, recipes, timelines, meat selection and trimming, plus smoker and fire information.\nThe cost to be in the class is $35 per person, and for spectators it is free. Included in the cost will be either a t-shirt or apron and you will be tasting samples of each meat that is prepared.',
  'timestamp': '2019-04-25T12:57:54Z'
}

Data Fields

The data have several fields:

  • url: url of the source as a string
  • text: text content as a string
  • timestamp: timestamp as a string

Data Splits

Sizes for the variants in english:

nametrainvalidation
en364868892364608
en.noblocklist393391519393226
en.noclean??
realnewslike1379983813863

A train and validation split are also provided for the other languages, but lengths are still to be added.

Source Data

Initial Data Collection and Normalization

The C4 and mC4 datasets are collections text sourced from the public Common Crawl web scrape. It includes heuristics to extract only natural language (as opposed to boilerplate and other gibberish) in addition to extensive deduplication. You can find the code that has been used to build this dataset in c4.py by Tensorflow Datasets.

C4 dataset was explicitly designed to be English only: any page that was not given a probability of at least 99% of being English by langdetect was discarded.

To build mC4, the authors used CLD3 to identify over 100 languages.

Licensing Information

We are releasing this dataset under the terms of ODC-BY. By using this, you are also bound by the Common Crawl terms of use in respect of the content contained in the dataset.

Acknowledgements

Big ups to the good folks at Common Crawl whose data made this possible (consider donating!), to Google for creating the code that curates and filters the data, and to Huggingface, who had no issue with hosting these 3TB of data for public download!

allenai/c4 · CoolFace