{"record":{"id":"016b0d3c975b4cc0","repo":"unslothai/unsloth","slug":"no-valid-examples-after-dac-preprocessing-skipped","errorCode":null,"errorMessage":"No valid examples after DAC preprocessing (skipped {skipped})","messagePattern":"No valid examples after DAC preprocessing \\(skipped (.+?)\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/training/trainer.py","lineNumber":2405,"sourceCode":"            if (idx + 1) % 100 == 0:\n                self._update_progress(\n                    status_message = f\"Preprocessing audio with OuteTTS... {idx + 1}/{len(dataset)}\"\n                )\n\n        # Free Whisper from GPU (notebook: whisper_model.to('cpu'))\n        logger.info(\"Moving Whisper model to CPU...\\n\")\n        whisper_model.to(\"cpu\")\n        del whisper_model\n        del audio_processor\n        del prompt_processor\n\n        gc.collect()\n\n        clear_gpu_cache()\n        self._cuda_audio_used = True\n\n        if not processed_examples:\n            raise ValueError(f\"No valid examples after DAC preprocessing (skipped {skipped})\")\n\n        result_dataset = HFDataset.from_list(processed_examples)\n        logger.info(\n            f\"DAC preprocessing complete: {len(result_dataset)} examples \" f\"({skipped} skipped)\\n\"\n        )\n        sample = result_dataset[0][\"text\"]\n        logger.info(f\"Sample text (first 200 chars): {sample[:200]}...\\n\")\n        return result_dataset\n\n    def _preprocess_whisper_dataset(\n        self,\n        dataset,\n        eval_split = None,\n        custom_format_mapping = None,\n    ):\n        \"\"\"Preprocess dataset for Whisper speech-to-text training.\n\n        Mirrors Whisper.ipynb: extract audio features with Whisper's feature","sourceCodeStart":2387,"sourceCodeEnd":2423,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/training/trainer.py#L2387-L2423","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the loop's per-example warnings — the recurring exception identifies the failure mode (alignment vs decode vs text).","Manually process dataset[0]: confirm the audio decodes and Whisper transcribes it with non-empty timings.","Filter or repair bad rows (silence-trim, re-encode, fill transcripts) and rebuild the dataset.","Note the error fires only when ALL rows fail — a few bad rows are skipped silently, so aim for a healthy majority."],"exampleFix":"// before: silent audio across the dataset yields no word timings\n// after: pre-filter non-silent examples\nimport numpy as np\nrows = [r for r in rows if np.abs(r['audio_array']).max() > 1e-4]","handlingStrategy":"validation","validationCode":"import numpy as np\n\ndef dac_examples_valid(dataset, n=3) -> bool:\n    for i in range(min(n, len(dataset))):\n        a = dataset[i]['audio']\n        arr = np.asarray(a.get('array', []))\n        if not (arr.size > 0 and np.abs(arr).max() > 1e-4 and dataset[i]['text'].strip()):\n            return False\n    return True\n\nassert dac_examples_valid(dataset), \"examples fail DAC/Whisper alignment requirements\"","typeGuard":null,"tryCatchPattern":"try:\n    ds = trainer._preprocess_dac_dataset(dataset, mapping)\nexcept ValueError as e:\n    if 'No valid examples after DAC preprocessing' in str(e):\n        # read per-example warnings; fix silent audio / bad transcripts, retry\n        ...","preventionTips":["Pre-filter silent clips and empty transcripts during dataset preparation.","Verify audio files decode at the expected sample rate from the training machine.","Treat a high skip rate in warnings as a stop condition even before the final raise."],"tags":["audio","dac","whisper","dataset","data-quality"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}