{"record":{"id":"adae86ed607fd3e8","repo":"unslothai/unsloth","slug":"no-valid-examples-after-bicodec-preprocessing-ski","errorCode":null,"errorMessage":"No valid examples after BiCodec preprocessing (skipped {skipped})","messagePattern":"No valid examples after BiCodec preprocessing \\(skipped (.+?)\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/training/trainer.py","lineNumber":2212,"sourceCode":"                continue\n\n            if (idx + 1) % 100 == 0:\n                self._update_progress(\n                    status_message = f\"Encoding audio with BiCodec... {idx + 1}/{len(dataset)}\"\n                )\n\n        logger.info(\"Freeing BiCodec tokenizer from GPU...\\n\")\n        audio_tokenizer.model.cpu()\n        audio_tokenizer.feature_extractor.cpu()\n        del audio_tokenizer\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 BiCodec preprocessing (skipped {skipped})\")\n\n        result_dataset = Dataset.from_list(processed_examples)\n        logger.info(\n            f\"BiCodec preprocessing complete: {len(result_dataset)} examples \"\n            f\"({skipped} skipped)\\n\"\n        )\n        sample = result_dataset[0][\"text\"]\n        logger.info(f\"Sample text (first 200 chars): {sample[:200]}...\\n\")\n        logger.info(f\"Sample text length: {len(sample)} chars\\n\")\n        return result_dataset\n\n    def _preprocess_dac_dataset(\n        self,\n        dataset,\n        custom_format_mapping = None,\n    ):\n        \"\"\"Preprocess dataset for OuteTTS training with DAC codec.\n","sourceCodeStart":2194,"sourceCodeEnd":2230,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/training/trainer.py#L2194-L2230","documentation":"ValueError raised at the end of BiCodec preprocessing when every example failed and was skipped, leaving processed_examples empty. During the loop each failure was caught and logged as a warning; after freeing the tokenizer from GPU the function checks the result and aborts with the skipped count. It indicates a systemic data problem (schema passed, contents failed), not a single bad row.","triggerScenarios":"All examples fail BiCodec tokenization/audio-volume-normalization: unreadable audio, wrong sample rates the loop's resampling rejects, empty transcripts, or audio paths that do not resolve.","commonSituations":"Audio files unavailable at their recorded paths; audio in a format the decoder cannot read; transcripts with encoding issues; dataset built on another machine with different absolute paths.","solutions":["Review the per-example warning logs from the loop for the underlying exception class and message.","Test one example manually: load its audio, run audio_volume_normalize, and confirm it succeeds.","Re-encode the audio to standard wav (e.g. 44.1kHz mono) and rebuild the dataset.","Verify transcript strings are non-empty and validly encoded."],"exampleFix":"// before: dataset has empty transcripts for all rows\n// after: filter/repair rows with empty text before training\nrows = [r for r in rows if r['text'].strip() and os.path.exists(r['audio'])]","handlingStrategy":"validation","validationCode":"import numpy as np\n\ndef bicodec_examples_valid(dataset, n=3) -> bool:\n    for i in range(min(n, len(dataset))):\n        a = dataset[i]['audio']\n        if not (a.get('array') is not None and np.asarray(a['array']).size > 0\n                and isinstance(dataset[i]['text'], str) and dataset[i]['text'].strip()):\n            return False\n    return True\n\nassert bicodec_examples_valid(dataset), \"examples fail BiCodec preprocessing\"","typeGuard":null,"tryCatchPattern":"try:\n    ds = trainer._preprocess_bicodec_dataset(dataset, mapping)\nexcept ValueError as e:\n    if 'No valid examples after BiCodec preprocessing' in str(e):\n        # inspect warnings; fix audio decoding / empty transcripts, then retry\n        ...","preventionTips":["Re-encode source audio to plain wav mono before building the dataset.","Reject empty transcripts at data-preparation time.","Test one example through the full tokenize path in a notebook before launching a run."],"tags":["audio","bicodec","tts","dataset","data-quality"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}