Nodes/Diffusion_pipe_in_ComfyUI/宽高比分桶配置
ComfyUI Node

宽高比分桶配置

Hand-write your aspect-ratio buckets when auto-bucketing gets it wrong

By TianDongL·Created 11 months ago·Updated 7 months ago· 69
宽高比分桶配置
    • ar_buckets
    ar_buckets[[512, 512], [448, 576]]

    Here's a genuinely thin node, and that's fine - some of the best nodes in this pack are just honest string pass-throughs. ArBucketsNode takes one input, a JSON-style list of width/height pairs, and hands it to the dataset config so diffusion-pipe groups your images into fixed resolution buckets instead of guessing.

    What it's for

    Modern training nearly always buckets across resolutions rather than training at one fixed size - the KB's LoRA training notes call multi-resolution bucketing "the default rather than an optimization" since the Flux era. The usual path is the automatic aspect-ratio bucketing on GeneralDatasetConfig (the enable_ar_bucket toggle with min_ar, max_ar and num_ar_buckets). That computes buckets from your dataset automatically.

    ArBucketsNode is the escape hatch. When you want to dictate the exact buckets yourself - say, to match the resolution buckets a particular base model was trained on, or because you know your dataset only makes sense at specific sizes - you feed this node a literal list and it bypasses the auto computation. The default, [[512, 512], [448, 576]], shows the format: a list of [width, height] pairs.

    One catch the author calls out in the tooltip: this manual list can't be combined with the automatic aspect-ratio bucket settings - it's one or the other. If you wire ArBucketsNode in, make sure enable_ar_bucket on the dataset config is off, or you'll get conflicting instructions downstream.

    Wiring it up

    The output is typed ar_buckets, and it plugs into the optional ar_buckets input on GeneralDatasetConfig (for training) or EvalDatasetConfig (for evaluation). The node itself does the lightest validation - the source literally just trims the string and warns if it's empty, falling back to the default - and passes the text through. [512, 512] means square 512×512 crops; add a [1280, 720] entry for a landscape tier if your content is widescreen.

    Installing the pack

    Same pack, same install as every node in TianDongL/Diffusion_pipe_in_ComfyUI - Linux/WSL2 only, and the submodule step is what makes training actually work:

    cd ComfyUI/custom_nodes/
    git clone --recurse-submodules https://github.com/TianDongL/Diffusion_pipe_in_ComfyUI.git
    git submodule update
    pip install -r Diffusion_pipe_in_ComfyUI/requirements.txt
    

    Restart ComfyUI and drag the example workflow in from example_workflows/.

    Pitfalls worth knowing

    The string must parse as a Python list, so mind your brackets and commas - [[512,512],[448,576]] is fine, a stray character isn't, and the node will just fall back to its default rather than telling you. That silent fallback is the real gotcha: if you "changed" the buckets and nothing did, check you didn't leave a trailing comma or wrong bracket that kicked you back to [[512, 512], [448, 576]]. And remember the pack-wide WSL2 path quirk if your dataset lives on a Windows drive - use Z:/ style paths in the dataset nodes feeding this.

    CategoryDiffusion-Pipe/dataset

    Inputs (1)

    NameTypeDefaultDescription
    ar_bucketsSTRING[[512, 512], [448, 576]]宽高对分桶配置,可选,不能与宽高比分桶同时使用

    Outputs (1)

    NameTypeDescription
    ar_bucketsar_buckets