unslothai/unsloth · error · ValueError

No valid examples after DAC preprocessing (skipped {skipped}

Error message

No valid examples after DAC preprocessing (skipped {skipped})

What it means

ValueError raised at the end of DAC preprocessing when processed_examples is empty — every example failed during the Whisper word-timing + DAC encoding pipeline and was skipped. Whisper, the audio processor, and prompt processor are then freed from GPU, and the empty-result check aborts training with the skipped count. Per-example failures were logged as warnings while the loop ran.

Source

Thrown at studio/backend/core/training/trainer.py:2405

            if (idx + 1) % 100 == 0:
                self._update_progress(
                    status_message = f"Preprocessing audio with OuteTTS... {idx + 1}/{len(dataset)}"
                )

        # Free Whisper from GPU (notebook: whisper_model.to('cpu'))
        logger.info("Moving Whisper model to CPU...\n")
        whisper_model.to("cpu")
        del whisper_model
        del audio_processor
        del prompt_processor

        gc.collect()

        clear_gpu_cache()
        self._cuda_audio_used = True

        if not processed_examples:
            raise ValueError(f"No valid examples after DAC preprocessing (skipped {skipped})")

        result_dataset = HFDataset.from_list(processed_examples)
        logger.info(
            f"DAC preprocessing complete: {len(result_dataset)} examples " f"({skipped} skipped)\n"
        )
        sample = result_dataset[0]["text"]
        logger.info(f"Sample text (first 200 chars): {sample[:200]}...\n")
        return result_dataset

    def _preprocess_whisper_dataset(
        self,
        dataset,
        eval_split = None,
        custom_format_mapping = None,
    ):
        """Preprocess dataset for Whisper speech-to-text training.

        Mirrors Whisper.ipynb: extract audio features with Whisper's feature

View on GitHub (pinned to 203007d190)

Solutions

  1. Read the loop's per-example warnings — the recurring exception identifies the failure mode (alignment vs decode vs text).
  2. Manually process dataset[0]: confirm the audio decodes and Whisper transcribes it with non-empty timings.
  3. Filter or repair bad rows (silence-trim, re-encode, fill transcripts) and rebuild the dataset.
  4. Note the error fires only when ALL rows fail — a few bad rows are skipped silently, so aim for a healthy majority.

Example fix

// before: silent audio across the dataset yields no word timings
// after: pre-filter non-silent examples
import numpy as np
rows = [r for r in rows if np.abs(r['audio_array']).max() > 1e-4]
Defensive patterns

Strategy: validation

Validate before calling

import numpy as np

def dac_examples_valid(dataset, n=3) -> bool:
    for i in range(min(n, len(dataset))):
        a = dataset[i]['audio']
        arr = np.asarray(a.get('array', []))
        if not (arr.size > 0 and np.abs(arr).max() > 1e-4 and dataset[i]['text'].strip()):
            return False
    return True

assert dac_examples_valid(dataset), "examples fail DAC/Whisper alignment requirements"

Try / catch

try:
    ds = trainer._preprocess_dac_dataset(dataset, mapping)
except ValueError as e:
    if 'No valid examples after DAC preprocessing' in str(e):
        # read per-example warnings; fix silent audio / bad transcripts, retry
        ...

Prevention

When it happens

Trigger: All examples fail during processing: audio that cannot be decoded at 24kHz, Whisper alignment failures on silent/empty audio, or transcripts/text normalization errors for every row.

Common situations: Silent or clipped audio files that produce no word timings; audio paths invalid from the training machine's cwd; dataset rows with empty text; wrong audio channel/format.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/016b0d3c975b4cc0. Report an issue: GitHub.