{"record":{"id":"d8b277c807820e17","repo":"unslothai/unsloth","slug":"no-text-column-found-in-dataset-columns-dataset","errorCode":null,"errorMessage":"No text column found in dataset. Columns: {dataset.column_names}","messagePattern":"No text column found in dataset\\. Columns: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/training/trainer.py","lineNumber":1689,"sourceCode":"\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\",\n            \"input_values_cutoffs\",\n        ]","sourceCodeStart":1671,"sourceCodeEnd":1707,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/training/trainer.py#L1671-L1707","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Rename the transcript column to a conventional text column name or add {'transcription': 'text'} to custom_format_mapping.","Generate transcripts (e.g. via ASR) and add a text column if the dataset lacks one.","Double-check the correct preprocessing path is used — audio-only datasets fit encoders, not CSM TTS."],"exampleFix":"// before\ndataset  # columns: ['audio', 'transcription']\n// after\ndataset = dataset.rename_column('transcription', 'text')\n# or pass custom_format_mapping={'transcription': 'text'}","handlingStrategy":"validation","validationCode":"def has_text_column(dataset) -> bool:\n    return any(c in dataset.column_names for c in ('text', 'transcript', 'transcription', 'sentence'))\n\nassert has_text_column(dataset), \"CSM dataset needs a transcript column\"","typeGuard":"def is_transcript_ready(dataset) -> bool:\n    return 'text' in dataset.column_names or any(\n        isinstance(v, str) and dataset[0][v] for v in dataset.column_names\n    )","tryCatchPattern":"try:\n    ds = trainer._preprocess_csm_dataset(dataset, mapping)\nexcept ValueError as e:\n    if 'No text column' in str(e):\n        mapping = {**(mapping or {}), detected_transcript_col: 'text'}\n        ds = trainer._preprocess_csm_dataset(dataset, mapping)","preventionTips":["Name transcript columns 'text' at dataset build time.","Include the transcript column in automated dataset validation before training starts.","When sources use 'sentence'/'transcription', rename or map consistently."],"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"}