Nodes/civitai-comfy-nodes/ai-toolkit / sdxl
ComfyUI Node

ai-toolkit / sdxl

SDXL and SD 1.5 LoRA training on the cloud — the familiar dials, no GPU

By civitai·Created 2 months ago·Updated about a month ago· 42
ai-toolkit / sdxl
  • continue_from
  • model
  • api_config
  • moderation_status
  • epochs
  • workflow_id
  • raw_json
ecosystemsdxl
training_data_json
storage_buzz_per_epoch0.00
default_steps0
uses_step_pricingfalse
max_batch_size0
samples_json
epochs1
steps1
batch_size1
lr0.00
text_encoder_lr0.00
train_text_encoderfalse
lr_scheduler
optimizer_type
network_dim1
network_alpha1
noise_offset0.00
flip_augmentationfalse
shuffle_tokensfalse
keep_tokens0
trigger_word
min_snr_gamma0

SDXL and SD 1.5 are the old reliable training grounds - the LoRA dials everyone already knows. CivitaiTrainingAiToolkitSdxl runs those familiar trainers on Civitai's cloud: pick sdxl or sd1 in the ecosystem dropdown, upload a zip of images, and get a downloadable LoRA per epoch. It's the most "classic" training node in the pack, and also the one with the most recognizably Kohya-flavored knobs - including min_snr_gamma, which older SD trainers have had for years.

It lives in the Civitai/Training/ai-toolkit menu of Civitai's official ComfyUI pack. Because SDXL/SD1.5 training is so well-trodden, this node is the gentlest on-ramp to Civitai's cloud training: the defaults are sane, the ecosystems are stable, and the LoRAs you make drop straight into the huge existing local SDXL/SD1.5 ecosystem. It also exposes a model input (a CIVITAI_AIR socket) so you can train on a specific SDXL/SD1.5 checkpoint by wiring a Civitai Model Selector's air output - useful if you want your LoRA tuned for a particular base model rather than the default.

How it works

The node submits a training workflow (engine: ai-toolkit, ecosystem: sdxl|sd1) to Civitai's Orchestration API. Your images go up as a hosted zip, the cloud runs AI Toolkit, and each epoch produces a downloadable LoRA. The core input is training_data_json, a JSON object:

{"type": "zip", "sourceUrl": "urn:air:sdxl:dataset:civitai:333@1", "count": 30}

sourceUrl is an AIR URN to the zip; count is the number of images, which is how the run is priced.

The inputs that matter

  • ecosystem (required) - sdxl (default) or sd1.
  • training_data_json (required) - the zip + count object.
  • model - optional base-model override via a Civitai Model Selector's air output.
  • epochs / steps - epochs = saved checkpoints (each a downloadable model), steps = total training length and the pricing driver.
  • trigger_word - the token that activates your LoRA in prompts.
  • network_dim / network_alpha, lr, lr_scheduler, optimizer_type, noise_offset, keep_tokens, shuffle_tokens, flip_augmentation, train_text_encoder, min_snr_gamma - the full classic menu. If you've trained SD LoRAs before, these are the dials you know; if you haven't, leave them alone.

The required-looking storage_buzz_per_epoch, default_steps, uses_step_pricing, max_batch_size fields are generated plumbing - leave them.

Outputs: moderation_status, epochs, plus the standard workflow_id and raw_json.

Installing it

This is one of ~160 nodes in Civitai Comfy Nodes, Civitai's official pack for their Orchestration API:

  • ComfyUI Manager: Manager → Custom Nodes Manager → search Civitai Comfy Nodes → Install, then restart.
  • CLI: comfy node registry-install civitai-comfy-nodes
  • Source: cd ComfyUI/custom_nodes && git clone https://github.com/civitai/civitai-comfy-nodes.git && pip install -r civitai-comfy-nodes/requirements.txt (just requests).

You need a Civitai account with Buzz and credentials - a Civitai Auth node, CIVITAI_API_TOKEN for headless, or a stored key via the Civitai sidebar.

Where people get burned

  • training_data_json must be valid JSON with type, sourceUrl, and count.
  • SDXL trains bigger than SD1.5. Expect a different cost profile per step; the node's cost report after each run shows what you actually spent.
  • Moderation gates the model. moderation_status reports whether your LoRA passed Civitai's content review - and SD's most famous training subjects (real people) are exactly what Civitai's real-person rules prohibit.
  • Early preview. The README warns of breaking changes without notice; early community reports include bugs and slow jobs. Long trainings can hit the default 30-minute timeout - raise it via the Auth node or CIVITAI_COMFY_TIMEOUT.

If you've got an SDXL character or style you want as a LoRA and a GPU you'd rather keep free, this is the node that needs the least re-learning. All the classic dials, none of the VRAM anxiety.

CategoryCivitai/Training/ai-toolkit

Inputs (26)

NameTypeDefaultDescription
ecosystemCOMBOsdxl2 options: sdxl, sd1
training_data_jsonSTRINGRepresents training data in various formats
storage_buzz_per_epochFLOAT0.000–2147483647Per-epoch surcharge (buzz). Each epoch is a delivered checkpoint plus its preview samples, billed on top of the per-step training cost — so raising the epoch count raises the price by this much each. Override per ecosystem where per-epoch samples are expensive to compute (e.g. video).
default_stepsINT00–2147483647Default total step budget when neither Civitai.Orchestration.Grains.Workflows.Steps.Training.AIToolkit.AIToolkitTrainingInput.Steps nor Civitai.Orchestration.Grains.Workflows.Steps.Training.AIToolkit.AIToolkitTrainingInput.Epochs is supplied. Override per ecosystem where the default training length differs (e.g. video needs more steps, quickly-overtrained models need fewer).
uses_step_pricingBOOLEANfalseTrue when billing uses the per-step model. This is the default; the only exception is the legacy path where the caller supplied Civitai.Orchestration.Grains.Workflows.Steps.Training.AIToolkit.AIToolkitTrainingInput.Epochs but no Civitai.Orchestration.Grains.Workflows.Steps.Training.AIToolkit.AIToolkitTrainingInput.Steps (existing consumers), which keeps the historical flat per-epoch price.
max_batch_sizeINT00–2147483647Ecosystem-specific maximum training batch size — the upper bound the user's Civitai.Orchestration.Grains.Workflows.Steps.Training.AIToolkit.AIToolkitTrainingInput.BatchSize is clamped to. Most ecosystems cap at 1.
samples_jsonoptSTRINGSample generation configuration for training workflows
epochsoptINT11–200Number of training epochs — the number of saved checkpoints produced (each epoch yields one downloadable model). When omitted it is derived from Civitai.Orchestration.Grains.Workflows.Steps.Training.AIToolkit.AIToolkitTrainingInput.Steps; when both are supplied, both are honored (epochs = checkpoint count, steps = total).
stepsoptINT11–10000Total number of training steps. This is the primary control over training length and determines pricing. When supplied, Civitai.Orchestration.Grains.Workflows.Steps.Training.AIToolkit.AIToolkitTrainingInput.Epochs (the number of saved checkpoints) is derived from it; when omitted, steps are derived from epochs.
batch_sizeoptINT11–4Training batch size. Defaults to 1; raise it (up to the ecosystem's maximum) to train faster at the cost of more GPU memory. A larger batch sees more images per step, so fewer steps are needed for a comparable result. Values above the ecosystem maximum are clamped down.
lroptFLOAT0.000–1Sets the learning rate for the model. This is the learning rate when performing additional learning on each attention block (and other blocks depending on the setting).
text_encoder_lroptFLOAT0.000–1Sets the learning rate for the text encoder. Only used when TrainTextEncoder is true. For models with multiple text encoders, this applies to all of them.
train_text_encoderoptBOOLEANfalseWhether to train the text encoder(s) alongside the model. Enabling this can improve prompt understanding but increases training time and memory usage.
lr_scheduleroptCOMBOYou can change the learning rate in the middle of learning. A scheduler is a setting for how to change the learning rate.
optimizer_typeoptCOMBOThe optimizer determines how to update the neural net weights during training. Various methods have been proposed for smart learning, but the most commonly used in LoRA learning is "adamw8bit".
network_dimoptINT11–256The larger the Dim setting, the more learning information can be stored, but the possibility of learning unnecessary information other than the learning target increases. A larger Dim also increases LoRA file size.
network_alphaoptINT11–256The smaller the Network alpha value, the larger the stored LoRA neural net weights. For example, with an Alpha of 16 and a Dim of 32, the strength of the weight used is 16/32 = 0.5, meaning that the learning rate is only half as powerful as the Learning Rate setting. If Alpha and Dim are the same number, the strength used will be 1 and will have no effect on the learning rate.
noise_offsetoptFLOAT0.000–1Adds noise to training images. 0 adds no noise at all. A value of 1 adds strong noise.
flip_augmentationoptBOOLEANfalseIf this option is turned on, the image will be horizontally flipped randomly. It can learn left and right angles, which is useful when you want to learn symmetrical people and objects.
shuffle_tokensoptBOOLEANfalseRandomly changes the order of your tags during training. The intent of shuffling is to improve learning. If you are using captions (sentences), this option has no meaning.
keep_tokensoptINT00–10If your training images have tags, you can randomly shuffle them. However, if you have words that you want to keep at the beginning, you can use this option to specify "Keep the first 0 words at the beginning". This option does nothing if the Shuffle Tokens option is off.
trigger_wordoptSTRINGA trigger word that activates the trained LoRA when used in prompts. Only applicable to certain ecosystems (sd1, sdxl, flux1, chroma, zimagebase, zimageturbo, flux2klein).
continue_fromoptCIVITAI_AIROptional previously-trained LoRA to continue training from ("train further"). When set, the first epoch resumes from this model instead of the base model, and the new epochs build on top of it.
min_snr_gammaoptINT00–20Learning is performed by putting noise of various strengths on the training image, but depending on the difference in strength of the noise on which it is placed, learning will be stable by moving closer to or farther from the learning target. Min SNR gamma was introduced to compensate for that. When learning images have little noise, it may deviate greatly from the target, so try to suppress this jump.
modeloptCIVITAI_AIRThe primary model to train upon.
api_configoptCIVITAI_CONFIGOptional Civitai Auth connection; defaults to CIVITAI_API_TOKEN or stored OAuth login.

Outputs (4)

NameTypeDescription
moderation_statusSTRING
epochsSTRING
workflow_idSTRING
raw_jsonSTRING