Nodes/comfyui_LLM_schools/LoRA or Adapter Arguments
ComfyUI Node

LoRA or Adapter Arguments

LoRA hyperparameters for the trainer, minus the LoRA jargon spiral

By heshengtao·Created 2 years ago·Updated 2 years ago· 7
LoRA or Adapter Arguments
    • peft_args
    r8
    lora_alpha32.0
    lora_dropout0.10
    is_enabletrue

    Lora_or_adapter_Arguments is the node you plug in when you pick lora or adapter as the fine_tuning_method on the pack's CausalLM_trainer. It builds a PEFT LoraConfig - rank, alpha, dropout - and hands it to the trainer as peft_args. That's its entire job, and for a training pack that's the most useful job in the room, because LoRA is how you fine-tune an LLM without melting your GPU. The trainer wraps the config with get_peft_model(), freezing the base weights and training only the small low-rank adapters - the same trick that powers image-model LoRAs, applied to text.

    One quirk worth knowing up front: adapter and lora map to the same LoraConfig in this pack's training core. So this node serves both methods, and the two options on the trainer are effectively aliases. Don't overthink the distinction.

    The inputs that matter (there are only three)

    • r (rank) - default 8. The size of the low-rank matrices. Rank 8 is the classic small-model default; rank 16 is the go-to when you have data to spare. The image-model advice about rank scaling doesn't fully transfer to LLM fine-tuning, but the principle does: too small and the adapter can't learn, too large and you're just slowly training the whole network.
    • lora_alpha - default 32. The scaling factor applied to the adapter's contribution. The folklore rule of thumb is alpha around 2×r; with r=8, alpha=32 is right in that sweet spot. If you raise r, raise alpha along with it to keep the effective step size sane.
    • lora_dropout - default 0.1. Dropout on the adapter layers. It's a regularizer; leave it at 0.1 unless you're overfitting.

    is_enable is the standard pack on/off switch - set it false and the node returns None, which the trainer treats as "no PEFT args."

    What to actually set

    For a first run: keep r=8, alpha=32, dropout 0.1. That's a proven, boring baseline. Then tune the learning rate in LLM_Arguments before you touch any of these - LR moves results far more than r does.

    Install

    ComfyUI Manager, search "comfyui_LLM_schools", or:

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

    then restart. Dependencies: huggingface_hub, datasets, transformers, peft - Manager installs them. If the node doesn't show up, check that the pack's config.ini exists (copy from config.ini.example); a missing one takes down the whole pack at import time.

    Common issues

    • "I set LoRA args but training still crashed." Double-check the trainer's fine_tuning_method - it must be lora (or adapter) for this node's output to be consumed. And note the pack's default full_fine_tuning method raises ValueError in the current code, so if you left the method untouched you'll hit that before this node's args ever matter.
    • The checkpoint folder. LLM_Arguments defaults output_dir to a relative results path, which resolves against wherever the training subprocess was launched. Not this node's fault, but it's the reason your LoRA "disappears" after training - set an absolute output_dir.

    It's a three-knob node with a clear purpose. You'll reach for it on every LoRA run, and after the first one you'll realize that's exactly the right amount of surface area.

    Category大模型学校(llm_schools)/模型训练(Model Training)

    Inputs (4)

    NameTypeDefaultDescription
    rINT81–64
    lora_alphaFLOAT32.00–100
    lora_dropoutFLOAT0.100–1
    is_enableBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    peft_argsARGS