Stew-10B-tokenized / README.md
Monster-Code's picture
Update README.md
cc7a24f verified
|
Raw History Blame Contribute Delete
7.07 kB
---
license: other
task_categories:
- text-generation
language:
- en
size_categories:
- 1B<n<10B
pretty_name: Stew-10B
tags:
- pretraining
- gpt2
- tokenized
- pre-tokenized
configs:
- config_name: default
data_files:
- split: train
path: data/*.parquet
---
![a4eabb77-0b9b-447b-a344-aaeaeb181821](https://cdn-uploads.huggingface.co/production/uploads/6a5f8c87a38cac087c2c6c05/O1nffJZXpsyWSmhjVhKBs.jpeg)
# Stew-10B
A 10-billion-token pretraining dataset for language models, already tokenized and ready to feed straight into a training loop.
## "Why am I just seeing numbers?"
If you opened the dataset viewer and saw rows that look like this:
```
[464, 2159, 3666, 318, 257, 1332, 286, 262, ...]
```
...that's not a bug. **This dataset doesn't contain text — it contains the token IDs that text was converted into.**
Here's what's going on. Before a language model can learn from text, every word (or piece of a word) has to be mapped to a number using a "tokenizer." The sentence `"The world"` becomes something like `[464, 995]` using the GPT-2 tokenizer. Models don't read letters — they read these integer IDs.
Most datasets on the Hub ship the raw text and leave tokenization to you. That works, but tokenizing 10 billion tokens worth of text takes **hours of CPU time** every time someone starts a training run. It's wasted work, repeated by everyone.
**Stew-10B skips that step.** The text has already been tokenized once, using the standard GPT-2 tokenizer, and the resulting integer IDs are what's stored here. You get:
- **Instant training startup** — no tokenization phase, just load and train
- **Deterministic data** — every user sees the exact same token stream, so experiments are reproducible
- **Smaller download** — token IDs compress better than raw UTF-8 text
The tradeoff is that the data is no longer human-readable in the viewer. If you want to see what a row actually says, you decode it:
```python
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained("gpt2")
print(tok.decode([464, 2159, 3666, 318, 257, 1332, 286, 262]))
# -> "The World My is a test of the"
```
## What's actually in each row
Each row in the parquet files contains **one training window of exactly 2,048 tokens** under the column `input_ids`. That's roughly 1,500 words of English text per row, which is a standard context length for pretraining smaller GPT-style models.
Rows are packed back-to-back from the original token stream, with documents separated by the special `<|endoftext|>` marker (token ID `50256`). So within a single row you might find the end of one Wikipedia article, the EOS token, and then the start of a web page — this is the standard "packed sequences" format used by nanoGPT, GPT-NeoX, Megatron, and basically every modern pretraining codebase.
## Where the text came from
Stew-10B is a careful mix of three well-known English pretraining corpora, blended at the token level to hit exact proportions:
| Source | Share | Tokens | What it is |
|---|---|---|---|
| [`wikimedia/wikipedia`](https://huggingface.co/datasets/wikimedia/wikipedia) (`20231101.en`) | 25% | 2.5B | Clean, encyclopedic English — the "high-quality" anchor |
| [`openbmb/Ultra-FineWeb`](https://huggingface.co/datasets/openbmb/Ultra-FineWeb) (English split) | 50% | 5.0B | Filtered Common Crawl — broad coverage of the open web |
| [`mlfoundations/dclm-baseline-1.0`](https://huggingface.co/datasets/mlfoundations/dclm-baseline-1.0) | 25% | 2.5B | DataComp-LM baseline — aggressively filtered web text |
The mix is designed to balance **quality** (Wikipedia), **diversity** (FineWeb), and **scale-trained signal** (DCLM) in roughly the proportions that have been shown to work well in recent small-model pretraining recipes.
## How to use it
### Option 1: Hugging Face `datasets` (easy mode)
```python
from datasets import load_dataset
ds = load_dataset("Monster-Code/Stew-10B-tokenized", split="train", streaming=True)
for row in ds:
tokens = row["input_ids"] # a list of 2048 integers
# ...feed into your model
break
```
Streaming is recommended because the full dataset is around 25 GB and you probably don't want all of it on disk at once.
### Option 2: Raw binary files (fast mode)
If you're running something like nanoGPT and want zero-overhead access, there's a second copy of the data stored as raw `uint16` binary files under `data_bin/`. These are flat token streams you can memory-map directly:
```python
import numpy as np
from huggingface_hub import hf_hub_download
path = hf_hub_download(
"Monster-Code/Stew-10B-tokenized",
"data_bin/train-00000-of-00020.bin",
repo_type="dataset",
)
tokens = np.memmap(path, dtype=np.uint16, mode="r")
print(tokens.shape) # (500_000_000,)
print(tokens[:16]) # first 16 token IDs
```
Each `.bin` file holds 500 million tokens (1 GB), and there are 20 of them. Concatenated in order, they reconstruct the full 10-billion-token stream.
## File layout
```
Monster-Code/Stew-10B-tokenized/
├── data/ ← the parquet files (what `datasets` loads)
│ ├── train-00000-of-00020.parquet
│ ├── train-00001-of-00020.parquet
│ └── ... (20 files total)
└── data_bin/ ← same tokens as raw uint16 binary
├── train-00000-of-00020.bin
├── train-00001-of-00020.bin
└── ... (20 files total)
```
Both folders contain the same tokens in the same order. Pick whichever format fits your pipeline.
## Technical details
- **Tokenizer:** `gpt2` (the fast / Rust implementation from `tokenizers`)
- **Vocabulary size:** 50,257
- **End-of-document marker:** `<|endoftext|>` (token ID `50256`), inserted after every document
- **Sequence length (parquet):** 2,048 tokens per row
- **Total tokens:** 10,000,000,000 (exact — enforced during the build)
- **Total parquet rows:** approximately 4,882,812
- **Parquet schema:** `input_ids: fixed_size_list<int32>[2048]`
- **Parquet compression:** zstd level 3
- **Binary format:** little-endian `uint16`, no header, no padding
## Licensing
This dataset is a derivative work combining three upstream sources. **Each source retains its original license** — you are responsible for complying with all of them if you use this dataset:
- **Wikipedia** → CC BY-SA 3.0 and GFDL ([details](https://huggingface.co/datasets/wikimedia/wikipedia))
- **Ultra-FineWeb** → see the [original dataset card](https://huggingface.co/datasets/openbmb/Ultra-FineWeb)
- **DCLM-baseline** → see the [original dataset card](https://huggingface.co/datasets/mlfoundations/dclm-baseline-1.0)
No additional restrictions are imposed by this repository, but the dataset is marked `license: other` because the upstream licenses are mixed and you need to read them yourself before any downstream use.
## Citation
If you use Stew-10B in research, please cite the three underlying datasets. This repository is a repackaging and does not claim original authorship of the text content.