Training: small finetune datasets fail with a misleading "no readable samples ... (0 failures)" error when the manifest is smaller than num_bucket_batches × batch_size × loader_procs
Summary. When finetuning on a small dataset, which is the main use case for finetune.yaml, training fails on the first batch with an error that points at the wrong cause:
ValueError: no readable samples in data/train_aligned.jsonl: every entry failed to load (0 failures). Check the paths in the manifest.Every entry is readable. The real cause is that the length-bucketing pool (#309) is never filled:
training/dataloader/loader.py:363-365only emits batches oncenum_bucket_batches * batch_sizesamples have been collected, and the leftover pool is dropped at the end of each pass.- Defaults:
num_bucket_batches = 20(training/args.py:39),loader_procs = 6(training/args.py:37), andfinetune.yamlusesbatch_size: 64(training/configs/finetune.yaml:28). SubprocessDataLoadershards the manifest acrossworld_size * loader_procsloaders. So with the stockfinetune.yaml, each loader needs at least 20 × 64 = 1,280 entries, which means about 7,680 utterances per GPU before a single batch comes out.- If a shard is smaller than that, no batch is ever yielded, and
loader.py:377-381raises the "every entry failed to load" error with0 failures.
The existing guard at loader.py:342 only checks len(entries) < batch_size, so it does not catch this.
(Before #318, _prefetch did not forward exceptions from its worker thread. The same situation was then a silent hang: 0 steps, GPU near idle, no error. We hit that on 2026-09-21 at dfff26e. HEAD now fails fast, which is much better, but the message sends you to check paths that are fine.)
Repro (HEAD 7972095, a CPU-only DataLoader call, 110-entry aligned manifest, dummy tokenizer):
from training.dataloader import DataLoader
dl = DataLoader("train_aligned.jsonl", lambda t: [1] * max(1, len(t) // 3), 16, 24000, 12.5,
30.0, 5.0, rank=0, world_size=1, num_bucket_batches=20)
next(iter(dl))
# ValueError: no readable samples in train_aligned.jsonl: every entry failed to load (0 failures). ...
# num_bucket_batches=1 -> first batch in 0.06 sSuggested fix (either or both):
- Validate up front: if
len(entries) < max(1, num_bucket_batches) * batch_size, raise a message that names the knobs. For example: "110 entries for this loader but the bucket pool needs 20 × 16 = 320; lowerdata.num_bucket_batches(1 disables bucketing) ordata.loader_procs, or use a larger manifest." Alternatively, clamp the pool to the shard size or flush the partial pool at the end of a pass. - Document this in
training/README.mdnext tofinetune.yaml: small-data finetunes needdata.num_bucket_batches: 1and a lowerdata.loader_procs.
Related gaps we hit on the same small finetune (happy to split these out):
- Validation fails only at the first validation step.
validate()(training/train.py:318-345) builds a fresh in-processDataLoaderwith the trainbatch_size. With a 10-entryvalid_jsonlandbatch_size: 16, it can never form a batch. Theloader.py:342guard fires at stepvalid_freq(2,500 infinetune.yaml), not at startup, so the run dies after the first training segment. Before #318 this was a silent hang at that step. Checking the valid manifest size at startup would catch it. model_configmust be a local path in training.load_model_configcallsload_config(Path(path))/Path(path).read_text()(training/modules/builders.py:39-40). The inference CLI acceptshttps://andhf://configs (pocket_tts/main.py), so pointingfinetune.yamlat a community model's hosted YAML seems natural but fails. Either accept the same URL forms or add a one-line note.
Environment: WSL2 Ubuntu 24.04, 1× RTX 5090, Python 3.10, finetuning seastar105/pocket-tts-korean-300m on about 9 minutes (120 clips) of speech.
Source: kyutai-labs/pocket-tts