hiyouga/LlamaFactory · error · NotImplementedError

Unknown load type: {dataset_attr.load_from}.

Error message

Unknown load type: {dataset_attr.load_from}.

What it means

NotImplementedError raised in _load_single_dataset when a dataset_attr.load_from value is none of the five supported sources: hf_hub, ms_hub, script, cloud_file, file. The load_from column is derived from how the entry is keyed in dataset_info.json, so this signals an unrecognized key in your dataset definition.

Source

Thrown at src/llamafactory/data/loader.py:91

    elif dataset_attr.load_from == "file":
        data_files = []
        local_path = os.path.join(data_args.dataset_dir, dataset_attr.dataset_name)
        if os.path.isdir(local_path):  # is directory
            for file_name in os.listdir(local_path):
                data_files.append(os.path.join(local_path, file_name))
        elif os.path.isfile(local_path):  # is file
            data_files.append(local_path)
        else:
            raise ValueError(f"File {local_path} not found.")

        data_path = FILEEXT2TYPE.get(os.path.splitext(data_files[0])[-1][1:], None)
        if data_path is None:
            raise ValueError("Allowed file types: {}.".format(",".join(FILEEXT2TYPE.keys())))

        if any(data_path != FILEEXT2TYPE.get(os.path.splitext(data_file)[-1][1:], None) for data_file in data_files):
            raise ValueError("File types should be identical.")
    else:
        raise NotImplementedError(f"Unknown load type: {dataset_attr.load_from}.")

    if dataset_attr.load_from == "ms_hub":
        check_version("modelscope>=1.14.0", mandatory=True)
        from modelscope import MsDataset  # type: ignore
        from modelscope.utils.config_ds import MS_DATASETS_CACHE  # type: ignore

        cache_dir = model_args.cache_dir or MS_DATASETS_CACHE
        dataset = MsDataset.load(
            dataset_name=data_path,
            subset_name=data_name,
            data_dir=data_dir,
            data_files=data_files,
            split=dataset_attr.split,
            cache_dir=cache_dir,
            token=model_args.ms_hub_token,
            use_streaming=data_args.streaming,
        )
        if isinstance(dataset, MsDataset):

View on GitHub (pinned to f28afaf635)

Solutions

  1. Open dataset_info.json and make the entry use exactly one supported key: file_name (file), hf_hub_url (hf_hub), ms_hub_url (ms_hub), script_url (script), or cloud_url (cloud_file).
  2. For datasets hosted at an HTTP(S) URL, use the cloud_file source via the cloud_url key.
  3. Validate your dataset_info.json against the documented schema in data/README.md after editing.
  4. Check for duplicate/extra keys in the entry — only one source key should be present.

Example fix

# before (dataset_info.json)
"mydata": {"url": "https://example.com/data.jsonl"}

# after
"mydata": {"cloud_url": "https://example.com/data.jsonl"}
Defensive patterns

Strategy: validation

Validate before calling

import json

ALLOWED = {"file_name", "hf_hub_url", "ms_hub_url", "script_url", "cloud_url"}

def entries_ok(info_path: str) -> list[str]:
    bad = []
    for name, cfg in json.load(open(info_path)).items():
        if not (set(cfg) & ALLOWED):
            bad.append(name)
    return bad

Prevention

When it happens

Trigger: Adding an entry to dataset_info.json whose single source key is misspelled or unsupported (e.g. "dataset_hub", "local_file", "url"), or an entry with no recognized source key at all; also possible after manual edits or forks that introduce new loading keys.

Common situations: Typos when hand-editing dataset_info.json; copying an entry from an incompatible LlamaFactory version whose key names changed; assuming URL loading is supported via a key like "url" when it is actually "cloud_file".

Related errors


AI-assisted analysis of hiyouga/LlamaFactory@f28afaf635 (2026-08-14). Data as JSON: /api/errors/c29cb225b60fc503. Report an issue: GitHub.