The Dataset Viewer has been disabled on this dataset.

C4 (English) — Tokenized for Megatron-LM

This dataset is a pre-tokenized version of the English split of C4 (Colossal Clean Crawled Corpus), converted into the Megatron-LM indexed binary format (.bin / .idx). It is intended to be used directly as pretraining data with Megatron-LM without re-running tokenization. It is used to reproduce the results in chen-hao-chao/ermine.

No text was added, removed, or filtered relative to the source; the only transformation is tokenization and serialization.

Dataset Summary

Property Value
Source dataset allenai/c4, config en
Tokenizer gpt2
Vocabulary size 50257
Total size on disk 350GB

File Structure

.
├── megatron_c4_en_train_text_document.bin
├── megatron_c4_en_train_text_document.idx
├── megatron_c4_en_val_text_document.bin
└── megatron_c4_en_val_text_document.idx

Each split consists of a pair of files:

  • .bin — a flat array of token ids for all documents, concatenated.
  • .idx — the index (document boundaries, sequence lengths, and pointers into .bin), using Megatron's MMapIndexedDataset format.

Both files of a pair must sit in the same directory and share the same prefix. Megatron refers to the pair by that prefix, without the extension.

How It Was Created

  1. The en configuration of allenai/c4 was exported to JSON Lines, one document per line with the document stored under the text key.
  2. The JSONL files were tokenized with Megatron-LM's preprocessing script (see chen-hao-chao/ermine)

Download

from huggingface_hub import snapshot_download

local_dir = snapshot_download(
    repo_id="chen-hao-chao/ermine-c4-dataset",
    repo_type="dataset",
    local_dir="./c4_megatron",
)

Or with the CLI:

huggingface-cli download "chen-hao-chao/ermine-c4-dataset" \
    --repo-type dataset --local-dir ./c4_megatron

License

The original C4 dataset is released by AllenAI under the ODC-BY license, and use is also subject to the Common Crawl Terms of Use. This derived, tokenized version is released under the same terms.

Citation

If you use this dataset, please cite the original C4 paper:

@article{raffel2020exploring,
  title   = {Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer},
  author  = {Raffel, Colin and Shazeer, Noam and Roberts, Adam and Lee, Katherine and Narang, Sharan and Matena, Michael and Zhou, Yanqi and Li, Wei and Liu, Peter J.},
  journal = {Journal of Machine Learning Research},
  volume  = {21},
  number  = {140},
  pages   = {1--67},
  year    = {2020}
}
Downloads last month
100

Collection including chen-hao-chao/ermine-c4-dataset