unslothai/unsloth · error · ValueError

No text column found in dataset. Columns: {dataset.column_na

Error message

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

What it means

ValueError raised during CSM preprocessing when an audio column was resolved but no text/transcript column could be found. CSM training pairs audio with its transcript, so text_col=None is fatal; the message prints the full column_names list to make the mismatch immediately visible in logs.

Source

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

        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",
            "input_values_cutoffs",
        ]

View on GitHub (pinned to 203007d190)

Solutions

  1. Rename the transcript column to a conventional text column name or add {'transcription': 'text'} to custom_format_mapping.
  2. Generate transcripts (e.g. via ASR) and add a text column if the dataset lacks one.
  3. Double-check the correct preprocessing path is used — audio-only datasets fit encoders, not CSM TTS.

Example fix

// before
dataset  # columns: ['audio', 'transcription']
// after
dataset = dataset.rename_column('transcription', 'text')
# or pass custom_format_mapping={'transcription': 'text'}
Defensive patterns

Strategy: validation

Validate before calling

def has_text_column(dataset) -> bool:
    return any(c in dataset.column_names for c in ('text', 'transcript', 'transcription', 'sentence'))

assert has_text_column(dataset), "CSM dataset needs a transcript column"

Type guard

def is_transcript_ready(dataset) -> bool:
    return 'text' in dataset.column_names or any(
        isinstance(v, str) and dataset[0][v] for v in dataset.column_names
    )

Try / catch

try:
    ds = trainer._preprocess_csm_dataset(dataset, mapping)
except ValueError as e:
    if 'No text column' in str(e):
        mapping = {**(mapping or {}), detected_transcript_col: 'text'}
        ds = trainer._preprocess_csm_dataset(dataset, mapping)

Prevention

When it happens

Trigger: Dataset contains audio (typed or mapped) but its transcript lives in a column with an unrecognized name and no custom_format_mapping entry maps it to 'text'; or the dataset genuinely lacks transcripts.

Common situations: Column named 'sentence', 'caption', or 'transcription' not covered by the mapping; CSV export where the text column header was renamed; building the dataset from raw audio files without metadata.

Related errors


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