Add SFT heldout 2.8K build entrypoint

This commit is contained in:
2026-07-01 15:23:25 +08:00
parent 90b7fd5e9d
commit 069f891ceb
2 changed files with 69 additions and 3 deletions

View File

@@ -16,16 +16,48 @@ dataset_building/generated/
That directory is ignored by git.
## Kept Dataset
## Kept Datasets
Only the latest public heldout 2K set is versioned here:
The latest public heldout 2K set is versioned here:
```text
heldout_public_mcq_2k_20260607/heldout_public_mcq_2k.jsonl
heldout_public_mcq_2k_20260607/heldout_public_mcq_2k_stats.json
```
Older in-domain heldout and earlier ratio-imbalanced 2K heldout datasets are intentionally not included.
The 2.8K in-domain SFT heldout is kept as a reproducible build recipe rather
than checked-in generated data. It contains seven ability dimensions with 400
examples each:
```text
science_reasoning
logic
code
chinese_exam
math
chinese_dialogue
english_dialogue
```
Build it with:
```bash
bash dataset_building/build_sft_heldout_2p8k_20260611.sh
```
By default this writes:
```text
dataset_building/generated/training_mix_v4_train1m_test2p8k_noupsample_nobbh_20260611/
heldout_2p8k.jsonl
heldout_exclusion_hashes.jsonl
train_1m.jsonl
build_stats.json
```
Use `OUT=/path/to/output` and `TOKENIZER=/path/to/tokenizer` to place the
validation set outside the repo or build it with a specific tokenizer. Generated
outputs stay ignored by git.
## SFT Builders

View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT_DIR"
export HF_ENDPOINT="${HF_ENDPOINT:-https://hf-mirror.com}"
export HF_HOME="${HF_HOME:-$ROOT_DIR/dataset_building/generated/.hf_home}"
export HF_DATASETS_CACHE="${HF_DATASETS_CACHE:-$ROOT_DIR/dataset_building/generated/.hf_datasets_cache}"
OUT="${OUT:-$ROOT_DIR/dataset_building/generated/training_mix_v4_train1m_test2p8k_noupsample_nobbh_20260611}"
TOKENIZER="${TOKENIZER:-$ROOT_DIR/model_building/generated_models/Qwen3-0.6B-DSV4-tokenizer-remap-v2}"
TRAIN_TOTAL="${TRAIN_TOTAL:-1000000}"
TEST_PER_GROUP="${TEST_PER_GROUP:-400}"
SEED="${SEED:-20260611}"
MAX_SEEN_PER_SOURCE="${MAX_SEEN_PER_SOURCE:-300000}"
mkdir -p "$OUT" "$HF_HOME" "$HF_DATASETS_CACHE"
python dataset_building/build_training_and_test_mix_v3.py \
--out "$OUT" \
--tokenizer "$TOKENIZER" \
--train-total "$TRAIN_TOTAL" \
--test-per-group "$TEST_PER_GROUP" \
--seed "$SEED" \
--hf-endpoint "$HF_ENDPOINT" \
--use-hf \
--allow-shortfall \
--trust-metadata-lengths \
--max-seen-per-source "$MAX_SEEN_PER_SOURCE"
echo "Wrote SFT heldout and train mix to: $OUT"
echo "Heldout: $OUT/heldout_2p8k.jsonl"
echo "Exclusion hashes: $OUT/heldout_exclusion_hashes.jsonl"