{"record":{"id":"3ace5e705c886a7f","repo":"unslothai/unsloth","slug":"no-audio-column-found-in-dataset-columns-datase","errorCode":null,"errorMessage":"No audio column found in dataset. Columns: {dataset.column_names}","messagePattern":"No audio column found in dataset\\. Columns: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/training/trainer.py","lineNumber":1687,"sourceCode":"        from datasets import Audio\n        import torch\n\n        processor = AutoProcessor.from_pretrained(\n            self.model_name,\n            trust_remote_code = getattr(self, \"trust_remote_code\", False),\n        )\n\n        # Some fine-tuned models save pad_to_multiple_of in tokenizer_config.json and\n        # _merge_kwargs leaks it into audio_kwargs, where EncodecFeatureExtractor rejects it.\n        processor.tokenizer.init_kwargs.pop(\"pad_to_multiple_of\", None)\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_key = resolved[\"speaker_col\"]\n\n        if audio_col is None:\n            raise ValueError(f\"No audio column found in dataset. Columns: {dataset.column_names}\")\n        if text_col is None:\n            raise ValueError(f\"No text column found in dataset. Columns: {dataset.column_names}\")\n        if speaker_key is None:\n            logger.info(\"No speaker found, adding default 'source' of 0 for all examples\\n\")\n            dataset = dataset.add_column(\"source\", [\"0\"] * len(dataset))\n            speaker_key = \"source\"\n\n        logger.info(\n            f\"CSM preprocessing: audio_col='{audio_col}', text_col='{text_col}', speaker_key='{speaker_key}'\\n\"\n        )\n\n        dataset = dataset.cast_column(audio_col, Audio(sampling_rate = 24000))\n\n        required_keys = [\n            \"input_ids\",\n            \"attention_mask\",\n            \"labels\",\n            \"input_values\",","sourceCodeStart":1669,"sourceCodeEnd":1705,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/training/trainer.py#L1669-L1705","documentation":"ValueError raised during CSM (speech-model) dataset preprocessing when _resolve_audio_columns plus the custom format mapping cannot locate any column usable as audio. The resolver inspects dataset.column_names for audio-typed or conventionally named columns; if none is found, audio_col stays None and preprocessing stops because CSM training fundamentally requires an audio column to resample to 24kHz and tokenize.","triggerScenarios":"Running a CSM fine-tune whose dataset has a text column but no audio column, or an audio column with an unconventional name (e.g. 'wav', 'clip') that neither the heuristics nor custom_format_mapping cover.","commonSituations":"Dataset built from a CSV/JSONL where audio paths live in a column named 'file' or 'path' rather than an Audio-typed column; the user forgot to supply custom_format_mapping in the trainer config; wrong model type selected for a text-only dataset.","solutions":["Provide a custom_format_mapping that maps your column name to 'audio' (e.g. {'wav': 'audio'}).","Rename the audio column to a conventional name the resolver detects, or cast it to datasets.Audio so it is detected by type.","Verify you selected the CSM model type for a dataset that actually contains audio."],"exampleFix":"// before\ndataset  # columns: ['transcript', 'wav']\ntrainer._preprocess_csm_dataset(dataset)  # raises\n// after\ndataset = dataset.rename_column('wav', 'audio')\ntrainer._preprocess_csm_dataset(dataset)","handlingStrategy":"validation","validationCode":"def has_audio_column(dataset, mapping=None) -> bool:\n    names = set(dataset.column_names)\n    if mapping and 'audio' in mapping.values():\n        return True\n    return any(c in names for c in ('audio', 'wav', 'waveform')) or \\\n        any(dataset.column_types[list(names).index(c)] == 'Audio' for c in names if False) or \\\n        any(f.type.name == 'Audio' for f in dataset.features.values())","typeGuard":"def is_csm_capable(dataset) -> bool:\n    feats = dataset.features\n    return any(getattr(f, 'name', '') == 'Audio' or isinstance(f, object) and str(f).startswith('Audio') for f in feats.values()) or 'audio' in dataset.column_names","tryCatchPattern":"try:\n    ds = trainer._preprocess_csm_dataset(dataset, mapping)\nexcept ValueError as e:\n    if 'No audio column' in str(e):\n        dataset = dataset.rename_column(user_audio_name, 'audio')\n        ds = trainer._preprocess_csm_dataset(dataset, mapping)","preventionTips":["Standardize dataset schemas to an 'audio' column cast with datasets.Audio before training.","Always pass custom_format_mapping when your column names deviate from conventions.","Add a schema assertion in the dataset-preparation pipeline, before GPU time is spent."],"tags":["audio","dataset","csm","speech","validation"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}