unslothai/unsloth · error · ValueError

No audio column found in dataset. Columns: {dataset.column_n

Error message

No audio column found in dataset. Columns: {dataset.column_names}

What it means

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.

Source

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

        from datasets import Audio
        import torch

        processor = AutoProcessor.from_pretrained(
            self.model_name,
            trust_remote_code = getattr(self, "trust_remote_code", False),
        )

        # Some fine-tuned models save pad_to_multiple_of in tokenizer_config.json and
        # _merge_kwargs leaks it into audio_kwargs, where EncodecFeatureExtractor rejects it.
        processor.tokenizer.init_kwargs.pop("pad_to_multiple_of", None)

        resolved = self._resolve_audio_columns(dataset, custom_format_mapping)
        audio_col = resolved["audio_col"]
        text_col = resolved["text_col"]
        speaker_key = resolved["speaker_col"]

        if audio_col is None:
            raise ValueError(f"No audio column found in dataset. Columns: {dataset.column_names}")
        if text_col is None:
            raise ValueError(f"No text column found in dataset. Columns: {dataset.column_names}")
        if speaker_key is None:
            logger.info("No speaker found, adding default 'source' of 0 for all examples\n")
            dataset = dataset.add_column("source", ["0"] * len(dataset))
            speaker_key = "source"

        logger.info(
            f"CSM preprocessing: audio_col='{audio_col}', text_col='{text_col}', speaker_key='{speaker_key}'\n"
        )

        dataset = dataset.cast_column(audio_col, Audio(sampling_rate = 24000))

        required_keys = [
            "input_ids",
            "attention_mask",
            "labels",
            "input_values",

View on GitHub (pinned to 203007d190)

Solutions

  1. Provide a custom_format_mapping that maps your column name to 'audio' (e.g. {'wav': 'audio'}).
  2. Rename the audio column to a conventional name the resolver detects, or cast it to datasets.Audio so it is detected by type.
  3. Verify you selected the CSM model type for a dataset that actually contains audio.

Example fix

// before
dataset  # columns: ['transcript', 'wav']
trainer._preprocess_csm_dataset(dataset)  # raises
// after
dataset = dataset.rename_column('wav', 'audio')
trainer._preprocess_csm_dataset(dataset)
Defensive patterns

Strategy: validation

Validate before calling

def has_audio_column(dataset, mapping=None) -> bool:
    names = set(dataset.column_names)
    if mapping and 'audio' in mapping.values():
        return True
    return any(c in names for c in ('audio', 'wav', 'waveform')) or \
        any(dataset.column_types[list(names).index(c)] == 'Audio' for c in names if False) or \
        any(f.type.name == 'Audio' for f in dataset.features.values())

Type guard

def is_csm_capable(dataset) -> bool:
    feats = dataset.features
    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

Try / catch

try:
    ds = trainer._preprocess_csm_dataset(dataset, mapping)
except ValueError as e:
    if 'No audio column' in str(e):
        dataset = dataset.rename_column(user_audio_name, 'audio')
        ds = trainer._preprocess_csm_dataset(dataset, mapping)

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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