{
  "id": "huggingface/dataset-split-key-error",
  "signature": "KeyError: \"Split 'validation' not found in dataset. Available splits: ['train', 'test']\"",
  "signature_zh": "键错误：数据集未找到分割 'validation'。可用分割：['train', 'test']",
  "regex": "KeyError: \"Split '[^']+' not found in dataset\\. Available splits: \\[.*\\]\"",
  "domain": "huggingface",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "The requested dataset split name (e.g., 'validation') does not exist in the dataset configuration; the dataset may use a different naming convention like 'val' or 'test'.",
  "root_cause_type": "generic",
  "root_cause_zh": "请求的数据集分割名称（如 'validation'）在数据集配置中不存在；数据集可能使用不同的命名约定，如 'val' 或 'test'。",
  "versions": [
    {
      "version": "datasets>=2.14.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "transformers>=4.30.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Python>=3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Using split='all' to load all data and then manually splitting may cause data leakage if the dataset has predefined splits.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Renaming the split after loading with rename_column does not create a new split; it only renames a column.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check available splits before loading and use the correct name:\nfrom datasets import get_dataset_split_names\nsplits = get_dataset_split_names('org/dataset')\nprint(splits)  # e.g., ['train', 'test']\n# Then use the correct split:\ndataset = load_dataset('org/dataset', split='test')",
      "success_rate": 0.95,
      "how": "Check available splits before loading and use the correct name:\nfrom datasets import get_dataset_split_names\nsplits = get_dataset_split_names('org/dataset')\nprint(splits)  # e.g., ['train', 'test']\n# Then use the correct split:\ndataset = load_dataset('org/dataset', split='test')",
      "condition": "",
      "sources": []
    },
    {
      "action": "If no validation split exists, create one from the training data:\nfrom datasets import load_dataset\ndataset = load_dataset('org/dataset', split='train')\ntrain_val = dataset.train_test_split(test_size=0.1, seed=42)\ntrain_dataset = train_val['train']\nval_dataset = train_val['test']",
      "success_rate": 0.9,
      "how": "If no validation split exists, create one from the training data:\nfrom datasets import load_dataset\ndataset = load_dataset('org/dataset', split='train')\ntrain_val = dataset.train_test_split(test_size=0.1, seed=42)\ntrain_dataset = train_val['train']\nval_dataset = train_val['test']",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Check available splits before loading and use the correct name:\nfrom datasets import get_dataset_split_names\nsplits = get_dataset_split_names('org/dataset')\nprint(splits)  # e.g., ['train', 'test']\n# Then use the correct split:\ndataset = load_dataset('org/dataset', split='test')",
    "If no validation split exists, create one from the training data:\nfrom datasets import load_dataset\ndataset = load_dataset('org/dataset', split='train')\ntrain_val = dataset.train_test_split(test_size=0.1, seed=42)\ntrain_dataset = train_val['train']\nval_dataset = train_val['test']"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://huggingface.co/docs/datasets/en/loading#splits",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.95,
  "resolvable": "true",
  "first_seen": "2023-04-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}