Skip to content

Troubleshooting

Sudhanshu edited this page Nov 18, 2026 · 1 revision

Troubleshooting

Use these checks to isolate dataset, tokenizer, checkpoint and launcher failures without changing unrelated components.

No rows for this distributed worker

The data iterator produced no usable samples. Check dataset configuration (en for the illustrated medical dataset), --hf-split train, --schema question_response, filtering, and special-token coverage. Setting --num-workers 0 eliminates worker sharding as one possible cause but does not correct schema or tokenizer errors.

python -m scripts.finetune_medical --help
python -c "from tokenizers import Tokenizer; t=Tokenizer.from_file('artifacts/healthcare_tokenizer.json'); print({x:t.token_to_id(x) for x in ['<pad>','<unk>','<bos>','<eos>']})"

Unk token <unk> not found in the vocabulary

The BPE model references an unknown-token marker that is not actually registered. The current tokenizer trainer includes <unk> as a special token; do not silently mutate a tokenizer used by a pretrained checkpoint, as vocabulary IDs and model embeddings must remain aligned. Audit problematic samples, test tokenizer coverage and preserve checkpoint compatibility.

Missing <eos> or vocabulary mismatch

Confirm special-token IDs and compare tokenizer.get_vocab_size() with ModelConfig.vocab_size. Stage 1 and Stage 2 must use matching tokenizer IDs and architecture.

SFT rejects --pretrained with --resume

This is intentional: use --pretrained for the first SFT run, or --resume to continue an SFT checkpoint. Never use both in the same command.

Checkpoint FileNotFoundError

For a single-process run, inspect the actual last.pt file in the selected output directory. Do not assume step_XXXXXXXX is a file; that pattern refers to the separate distributed-checkpoint format.

Get-ChildItem .\checkpoints -Recurse -File | Select-Object -ExpandProperty FullName

Distributed initialization errors

The repository's single-process strategy starts with python -m scripts... and avoids distributed rendezvous. Other strategies require a properly configured PyTorch distributed backend. Resolve backend compatibility separately from dataset/model failures.

Training metrics are unexpectedly noisy

Check the validation sample count, fixed seed, data overlap, truncation and answer-only masking. A few token-level measurements should not be interpreted as clinical quality.

Clone this wiki locally