Nodes/comfyui_LLM_schools/download/load the HF dataset
ComfyUI Node

download/load the HF dataset

Pull any Hugging Face dataset into your workflow without leaving the graph

By heshengtao·Created 2 years ago·Updated 2 years ago· 7
download/load the HF dataset
    • local_dir
    repo_idrajpurkar/squad_v2
    cache_dirdatasets
    tokenhf_XXX
    force_downloadtrue
    is_enabletrue

    download_dataset is the first step in the LLM School pack's training pipeline: it grabs a dataset from Hugging Face and saves it to disk, so the next node (split_dataset) can work with local files instead of re-fetching over the network. It's a thin wrapper around huggingface_hub.snapshot_download() with repo_type="dataset", marked as an output node so it sits at the end of a data-preprocessing chain and visibly reports its result.

    You feed it a repo_id - the owner/name handle of any public dataset on the Hub - and it downloads the whole thing into a cache folder inside the pack (<pack>/datasets, or wherever you point cache_dir). The output is a single string: the absolute local path to the downloaded files. That's the local_dir you'll paste into split_dataset.

    The inputs that matter

    • repo_id - default rajpurkar/squad_v2. This is the dataset the pack's trainer was written against (SQuAD-style question/context/answers), so it's the safe starting point. Swap in anything you found with get_dataset_name.
    • cache_dir - default datasets, resolved relative to the pack folder. Relative paths can surprise you; if you want the data somewhere predictable, give an absolute path.
    • token - the trap. The default is the literal string hf_XXX. Leave it there and the code passes hf_XXX as your auth token, which fails with a 401 on anything that actually requires auth. Set it to a real token from https://huggingface.co/settings/tokens, or set it to an empty string so it falls back to the HF_token value in the pack's config.ini. Public datasets like squad_v2 don't need a token at all.
    • force_download - defaults to True, which means it re-downloads everything on every run. Turn it off once you've got a copy locally; it's the default that'll waste your bandwidth for no reason.

    How to install

    ComfyUI Manager, search "comfyui_LLM_schools" - or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/heshengtao/comfyui_LLM_schools
    

    then restart ComfyUI. requirements.txt is light - huggingface_hub, datasets, transformers, peft - and Manager installs it for you.

    Common issues

    • The node doesn't appear at all. The pack reads config.ini at import time, and if that file doesn't exist the whole dataset.py module fails to load (the pack's __init__.py swallows the error). The repo ships config.ini.example; copy it to config.ini inside the pack folder before you restart, then put a real token (or #zh_CN/en_US for the language) in it.
    • "The default token isn't accepted." See above - hf_XXX is a placeholder, not a valid token. Empty the field for public datasets.
    • Deprecation warnings or an error about local_dir_use_symlinks. The code passes that argument to snapshot_download, and newer huggingface_hub versions deprecated/removed it. Usually just a warning; if it hard-fails, update huggingface_hub to a current version where the parameter is tolerated or ignored.

    It's a simple, opinionated node - the opinion being "download SQuAD-style QA datasets and fine-tune causal LMs on them." If that's your plan, this is the cleanest way to get data onto disk from inside ComfyUI.

    Category大模型学校(llm_schools)/数据预处理(data preprocessing)

    Inputs (5)

    NameTypeDefaultDescription
    repo_idSTRINGrajpurkar/squad_v2
    cache_dirSTRINGdatasets
    tokenSTRINGhf_XXX
    force_downloadBOOLEANtrue
    is_enableBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    local_dirSTRING