{"record":{"id":"67186a5a27f55f26","repo":"unslothai/unsloth","slug":"snac-dataset-needs-audio-and-text-columns-got","errorCode":null,"errorMessage":"SNAC dataset needs 'audio' and 'text' columns, got: {dataset.column_names}","messagePattern":"SNAC dataset needs 'audio' and 'text' columns, got: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/training/trainer.py","lineNumber":1879,"sourceCode":"        tokenizer = self.tokenizer\n\n        # Orpheus special token IDs (hardcoded in tokenizer vocabulary)\n        START_OF_HUMAN = 128259\n        END_OF_HUMAN = 128260\n        START_OF_AI = 128261\n        END_OF_AI = 128262\n        START_OF_SPEECH = 128257\n        END_OF_SPEECH = 128258\n        END_OF_TEXT = 128009\n        AUDIO_OFFSET = 128266\n\n        resolved = self._resolve_audio_columns(dataset, custom_format_mapping)\n        audio_col = resolved[\"audio_col\"]\n        text_col = resolved[\"text_col\"]\n        speaker_col = resolved[\"speaker_col\"]\n        has_source = speaker_col is not None\n        if not audio_col or not text_col:\n            raise ValueError(\n                f\"SNAC dataset needs 'audio' and 'text' columns, got: {dataset.column_names}\"\n            )\n\n        # Cast audio so datasets 4.x AudioDecoder objects decode to dicts\n        from datasets import Audio\n\n        dataset = dataset.cast_column(audio_col, Audio(sampling_rate = SNAC_SAMPLE_RATE))\n\n        # Sample rate from first example (after cast, always SNAC_SAMPLE_RATE)\n        first_audio = dataset[0][audio_col]\n        ds_sample_rate = (\n            first_audio.get(\"sampling_rate\", SNAC_SAMPLE_RATE)\n            if isinstance(first_audio, dict)\n            else SNAC_SAMPLE_RATE\n        )\n\n        self._update_progress(status_message = \"Loading SNAC codec model...\")\n        logger.info(\"Loading SNAC codec model...\\n\")","sourceCodeStart":1861,"sourceCodeEnd":1897,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/training/trainer.py#L1861-L1897","documentation":"ValueError raised at the start of SNAC preprocessing (audio-language-model path) when _resolve_audio_columns cannot find both audio and text columns. SNAC codecs require the audio (to encode at SNAC_SAMPLE_RATE) and its transcript, so either missing is fatal before any model loading or GPU work happens.","triggerScenarios":"SNAC fine-tune where the dataset lacks a text column, lacks audio, or has them under names not covered by the resolver/custom_format_mapping; speaker_col is optional (has_source) but audio and text are not.","commonSituations":"Unmapped column names ('voice', 'transcript_raw'); dataset exported with only audio for codec pretraining; selecting the SNAC model for a plain text LLM dataset.","solutions":["Add custom_format_mapping entries mapping your column names to 'audio' and 'text'.","Rename the columns to conventional audio/text names.","Ensure the dataset genuinely contains both audio and transcripts for SNAC training."],"exampleFix":"// before\ndataset  # columns: ['voice', 'transcript_raw']\n// after\ndataset = dataset.rename_column('voice', 'audio').rename_column('transcript_raw', 'text')","handlingStrategy":"validation","validationCode":"def snac_ready(dataset) -> bool:\n    return 'audio' in dataset.column_names and 'text' in dataset.column_names\n\nassert snac_ready(dataset), \"SNAC needs 'audio' and 'text' columns\"","typeGuard":"def is_snac_dataset(dataset) -> bool:\n    return 'audio' in dataset.column_names and 'text' in dataset.column_names","tryCatchPattern":"try:\n    ds = trainer._preprocess_snac_dataset(dataset, mapping)\nexcept ValueError as e:\n    if \"SNAC dataset needs\" in str(e):\n        mapping = {**(mapping or {}), 'voice': 'audio', 'transcript': 'text'}\n        ds = trainer._preprocess_snac_dataset(dataset, mapping)","preventionTips":["Use canonical 'audio'/'text' names when preparing SNAC datasets.","Include custom_format_mapping in saved trainer configs for non-standard schemas.","Run a column check as part of the pre-flight before loading SNAC codecs to GPU."],"tags":["audio","snac","dataset","validation"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}