Data Pipeline
PremiumUnderstand how Parquet shards become input_ids, labels, and attention_mask
This section ties together the previous chapters: the pretraining data has already been split into Parquet shards, the tokenizer can already turn text into token ids, and the model has already been defined. What's missing in between is the data pipeline.
In cookllm-bento, the process of generating a pretraining batch can be summarized as:
Pretrain Data Pipeline
How a Parquet row becomes a training batch for next-token prediction.
This pipeline is handled by two files:
| Level | File | Role |
|---|---|---|
| DataModule | src/datamodule/pretrain_datamodule.py | Parse data paths, load the tokenizer, split train/val, create the DataLoader |
| Dataset | src/dataset/pretrain.py | Stream-read Parquet, batch tokenization, generate a single training sample |
Configuration Entrypoint
The core fields of the data config used by the pretraining example are as follows:
Log in to continue reading
This is premium content. Please log in to access the full article.
CookLLM Docs