Nodes/ComfyUI_Wan2_1_lora_trainer/Musubi Dataset Config (Wan)
ComfyUI Node

Musubi Dataset Config (Wan)

Turn a folder of images into a training config

By jaimitoes·Created about a year ago·Updated about a year ago· 61
Musubi Dataset Config (Wan)
    • dataset_toml_path
    • trigger_out
    output_filename_prefixmusubi_dataset_config
    general_resolution_width512
    general_resolution_height512
    general_caption_extension.txt
    general_batch_size1
    general_enable_buckettrue
    general_bucket_no_upscalefalse
    dataset1_image_directoryimage_text_path
    dataset1_cache_directorycache_path
    dataset1_num_repeats1
    dataset1_override_resolutionfalse
    dataset1_resolution_width512
    dataset1_resolution_height512

    If you're training a Wan 2.1 LoRA inside ComfyUI, this is where every run starts. WanDatasetConfig (display name "Musubi Dataset Config (Wan)") doesn't train anything and doesn't load any model - it looks at your folder of training images and their .txt captions and writes the .toml dataset file that every later node in the pack is going to read. Think of it as the paperwork node. Boring, but if you get it wrong, the whole pipeline fails before a single step of training runs.

    The pack is jaimitoes/ComfyUI_Wan2_1_lora_trainer, a GUI wrapper around kohya-ss/musubi-tuner. Musubi is kohya's video-trainer lineage, and its docs (linked in the pack README) are the authority on what the settings here actually do. What this node does is take all of that command-line config-writing and shrink it into one form you can fill out in the graph.

    How it works

    Clicking it runs generate_config, which builds a dictionary with a general section (resolution, caption extension, batch size, bucket flags) plus a datasets list, then dumps it as TOML into ComfyUI/output/musubi_tuner_configs/ with a timestamp in the filename. The output path is your dataset_toml_path. Musubi's cache scripts and trainer all take a dataset config path as their entry point, so this single file is the handoff between your folder on disk and the training machinery.

    The inputs that matter

    • dataset1_image_directory - the folder of training images. Each image needs a matching caption file: cat.png + cat.txt. The README is explicit that this isn't video-only; plain images train fine too.
    • dataset1_cache_directory - where the latents and text embeddings get cached later. The author's advice: use a fresh, empty folder per LoRA, so caches from different runs don't mix.
    • general_resolution_width / general_resolution_height - default 512×512. This is the trap. The tooltip on the node itself says it: override is required to swap the 512 default. Video trains at 832×480 or 1280×720, not 512 square, so bump this before you cache anything.
    • general_enable_bucket - on by default, keep it on. Bucketing groups images into aspect-ratio buckets so mixed-aspect datasets don't get squished.
    • general_caption_extension - .txt by default. Leave it unless your captions live in a different format.
    • dataset1_num_repeats - how many times each sample is seen per epoch. 1 is the sane start.

    One genuine quirk before you go cross-eyed reading the tooltips: the author pasted the wrong descriptions onto a few fields (the dataset1_image_directory and dataset1_cache_directory tooltips are swapped, and dataset1_num_repeats inherits the cache-directory text). Trust the names, not the tooltips, on this node.

    Outputs

    • dataset_toml_path (STRING) → wire into the dataset_config_toml input of WanCacheLatents.
    • trigger_out (any) → chain it into the next node's trigger_in so the pipeline runs in order.

    Install

    ComfyUI Manager → Install Custom Nodes → search ComfyUI_Wan2_1_lora_trainer, or clone it manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jaimitoes/ComfyUI_Wan2_1_lora_trainer
    

    then install requirements and restart:

    ..\..\..\python_embeded\python -m pip install -r requirements.txt
    

    This pack is built for the Windows portable ComfyUI (Python 3.12, PyTorch 2.7.1) and the README expects you to launch ComfyUI from a custom .bat that loads Visual Studio Build Tools (vcvarsall.bat amd64) first, plus extract the bundled Include_and_libs.zip into your python_embeded. Don't skip those steps - the training node runs in a subprocess and will fail on paths otherwise.

    Where people get burned

    The 512 default resolution, mostly - it silently caps your dataset if you don't override it. Second: pointing every LoRA at one shared cache folder, which mixes cached latents between runs. Give each project its own cache directory and you'll dodge a confusing chunk of "why is my training garbage" posts.

    Categorymusubi-tuner/wan/config

    Inputs (13)

    NameTypeDefaultDescription
    output_filename_prefixSTRINGmusubi_dataset_configGenerates the training dataset with the specified settings, this will set the training resolution. Override is needed to swap the 512 default res.
    general_resolution_widthINT512The general width for training images. This is the base resolution for your dataset, especially when buckets are disabled or for initial scaling.
    general_resolution_heightINT512The general height for training images. This is the base resolution for your dataset, especially when buckets are disabled or for initial scaling.
    general_caption_extensionSTRING.txtThe file extension for your caption (description) files (e.g., '.txt'). These files contain the text describing each image in your dataset.
    general_batch_sizeINT1The number of images processed simultaneously by the model during training. A higher batch size can speed up training but requires more VRAM.
    general_enable_bucketBOOLEANtrueIf enabled, images will be grouped into 'buckets' (different resolutions with similar aspect ratios) to optimize VRAM usage and prevent image distortion during training. Recommended to keep enabled.
    general_bucket_no_upscaleBOOLEANfalseIf 'Enable Bucket' is active and this is true, images will only be downscaled to fit a bucket's resolution, never upscaled. This can prevent blurry images but might make small images too small.
    dataset1_image_directorySTRINGimage_text_pathIf 'Enable Bucket' is active and this is true, images will only be downscaled to fit a bucket's resolution, never upscaled. This can prevent blurry images but might make small images too small.
    dataset1_cache_directorySTRINGcache_pathThe path to the directory containing the images for this specific dataset. Each image should have a corresponding caption file in the same directory.
    dataset1_num_repeatsINT1The path to the directory where cached versions of the processed dataset (e.g., VAE latents, text embeddings) will be stored. Speeds up subsequent training runs.
    dataset1_override_resolutionBOOLEANfalseIf enabled, this dataset will use its own specific resolution (`dataset1_resolution_width/height`) instead of the `general_resolution_width/height`.
    dataset1_resolution_widthINT512The specific width for images in this dataset if 'Override Resolution' is enabled. Otherwise, the general resolution will be used.
    dataset1_resolution_heightINT512The specific height for images in this dataset if 'Override Resolution' is enabled. Otherwise, the general resolution will be used.

    Outputs (2)

    NameTypeDescription
    dataset_toml_pathSTRING
    trigger_out*