Dataset Card for mC4-es-sampled

Dataset Summary

This dataset is the result of applying perplexity sampling to the Spanish portion of mC4 using mc4-sampling. Please, refer to BERTIN Project.

You can load the mC4 Spanish sampled like this:

from datasets import load_dataset

for config in ("random", "stepwise", "gaussian"):
    mc4es = load_dataset(
    for sample in mc4es:
        print(config, sample)

Alternatively, you can bypass the datasets library and quickly download (~1.5hrs, depending on connection) a specific config in the same order used to pre-train BERTIN models in a massive (~200GB) JSON-lines files:

import io
import gzip
import json
import sys

import requests
from tqdm import tqdm

_DATA_URL_TRAIN = "{config}-shard-{index:04d}-of-{n_shards:04d}.json.gz"

def main(config="stepwise"):
    data_urls = [
            index=index + 1,
        for index in range(1024)
    with open(f"mc4-es-train-50M-{config}.jsonl", "w") as f:
        for dara_url in tqdm(data_urls):
            response = requests.get(dara_url)
            bio = io.BytesIO(response.content)
            with, "rt", encoding="utf8") as g:
                for line in g:
                    json_line = json.loads(line.strip())
                    f.write(json.dumps(json_line) + "\

if __name__ == "__main__":

Supported Tasks and Leaderboards

mC4-es-sampled is mainly intended for reproducibility purposes of the BERTIN Project and to pretrain language models and word representations on medium budgets.


The dataset only supports the Spanish language.

Dataset Structure

Data Instances

An example form the Gaussian config:

{'timestamp': '2018-10-20T06:20:53Z', 'text': 'Ortho HyaluroTop 200 aporta el colágeno y ácido hialurónico que, con la edad, se producen en menor cantidad. La vitamina C promueve la producción de colágeno para mantener la piel sana y protege a las células contra los radicales libres causados ??por la contaminación ambiental y los rayos UV.', 'url': ''}

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

The resulting mC4 subsets for Spanish are reported in this table:

config train
stepwise 50M
random 50M
gaussian 50M

The split validation is exactly the same as the original mc4 dataset.

Dataset Creation

Curation Rationale

This dataset was built from the original mc4 by applying perplexity-sampling via mc4-sampling for Spanish.

Additional Information

Dataset Curators

Original data by Common Crawl.

Licensing Information

AllenAI 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.

Citation Information

    author = {Colin Raffel and Noam Shazeer and Adam Roberts and Katherine Lee and Sharan Narang and Michael Matena and Yanqi Zhou and Wei Li and Peter J. Liu},
    title = {Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer},
    journal = {arXiv e-prints},
    year = {2019},
    archivePrefix = {arXiv},
    eprint = {1910.10683},


Dataset contributed by @versae for BERTIN Project.

Thanks to @dirkgr and @lhoestq for adding the original mC4 dataset.

Models trained or fine-tuned on bertin-project/mc4-es-sampled

None yet