BluScriptCP-data / README.md
unparallelled's picture
Add files using upload-large-folder tool
0bf36fe verified
|
Raw History Blame Contribute Delete
3.4 kB
metadata
license: other
language:
  - en
task_categories:
  - text-generation
tags:
  - gpt2
  - tokenized
  - long-context
  - pretraining
size_categories:
  - 10B<n<100B

BluScriptCP tokenized token buckets (b1, b2, b3)

Pre-tokenized GPT-2 data for long-context training in the BluScriptCP / Context Parallelism project. These are the three mid-length buckets of a token-bucketed, deduplicated CommonCrawl-derived corpus (new_full_2025_51+47, dclm+betr).

Documents are bucketed by GPT-2 token length into half-open ranges [lo, hi). Only b1, b2 and b3 are published here.

bucket token range shards documents GPT-2 tokens size
b1_4096_8192 [4,096, 8,192) 96 2,571,614 13,977,775,051 28.0 GB
b2_8192_16384 [8,192, 16,384) 96 634,512 6,990,738,341 14.0 GB
b3_16384_32768 [16,384, 32,768) 96 142,657 3,027,863,374 6.1 GB
total 288 3,348,783 23,996,376,766 48.1 GB

Format

Tokenizer is tiktoken encoding gpt2 (vocab 50,257), applied with encode_ordinary, which treats <|endoftext|>-like text as ordinary tokens.

Each of the 288 shards has three files under <bucket>/:

file dtype contents
part_XX.bin uint16 GPT-2 token ids, documents concatenated, no separator
part_XX.idx.npy int64 cumulative offsets, length ndocs + 1
part_XX.meta.json - per-shard document count, token count, verification counters

Token ids fit uint16 losslessly since the GPT-2 vocabulary is 50,257 < 65,536.

No EOT separator is inserted. Document boundaries are carried exactly by the index, so a packing step must insert its own delimiter if one is needed.

Usage

import numpy as np

stem = "b1_4096_8192/part_00"
idx = np.load(stem + ".idx.npy")                                  # int64, ndocs+1
tok = np.memmap(stem + ".bin", dtype=np.uint16, mode="r")          # uint16 stream

n_docs = len(idx) - 1
doc_0 = tok[idx[0]:idx[1]]        # document 0 as a uint16 array of token ids

import tiktoken
enc = tiktoken.get_encoding("gpt2")
print(enc.decode(doc_0.tolist())[:200])

To iterate every document in a shard:

for i in range(len(idx) - 1):
    doc = tok[idx[i]:idx[i + 1]]

Verification

Every document in the source corpus carries a pre-computed gpt2_tokens count. Each document's re-tokenized length was compared against it:

  • 0 count mismatches across all 3,348,783 documents in these three buckets (and 0 across all 74,643,792 documents of the full 7-bucket corpus).
  • Document and token totals are an exact match to the corpus summary.tsv.
  • Index integrity checked per shard: len(bin) == idx[-1], idx[0] == 0, idx strictly increasing, max(token_id) < 50257.
  • Exact text roundtrip: enc.decode(bin[idx[i]:idx[i+1]]) is byte-identical to the source content field on sampled documents from every bucket.

Not included

The other four buckets of the corpus exist but are not published here: b0_lt_4096 (71.25 M docs, 73.59 B tokens), b4_32768_65536, b5_65536_131072, b6_gte_131072.

Provenance

Derived from CommonCrawl via the DCLM and BETR filtering pipelines, then deduplicated. Records retain their original scores and metadata upstream; only the token ids are published here. Respect the licensing and terms of the underlying CommonCrawl data.