Skip to content

Sen-sou/Bobs-Lora-Loader-Anima

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bobs LoRA Loader for ComfyUI

image image

An advanced LoRA loader for ComfyUI that provides granular, block-level control over how a LoRA is applied to SDXL, FLUX, and Anima models, giving you unparalleled control over your image generation process.

This node allows you to go beyond a single strength slider and specify different weights for distinct parts of the model, such as the text encoder, the U-Net input blocks, and the output blocks. This is particularly useful for mixing and matching LoRA concepts, strengthening character details while reducing stylistic influence, or vice-versa.

Features

  • Model Support: Separate, optimized loaders for SDXL, FLUX, and Anima models, each tailored to the architecture's specific blocks.
  • Granular Block-Level Control: Fine-tune the strength of a LoRA on different conceptual parts of the diffusion model.
  • Intelligent Presets: Comes with pre-configured presets for common use cases like Character, Style, Concept, and Fix Hands/Anatomy.
  • Full Customization: Set the preset to Custom to get direct slider control over every block for ultimate fine-tuning.
  • Robust LoRA Compatibility: Intelligently handles multiple LoRA naming conventions (e.g., lora_unet_..., unet..., lora_transformer_..., etc.) to ensure broad compatibility with community-made files.
  • Standard LoRA Functionality: To use it like a standard LoRA loader, simply select the Full (Normal LoRA) preset.

Installation

  1. Navigate to your ComfyUI custom_nodes directory:
    cd ComfyUI/custom_nodes/
  2. Clone this repository:
    git clone https://github.com/BobsBlazed/Bobs-Lora-Loader
  3. Restart ComfyUI.

How to Use

  1. In ComfyUI, add the node by right-clicking, selecting "Add Node," and navigating to the Bobs_Nodes category.
  2. Choose Bobs LoRA Loader (SDXL), Bobs LoRA Loader (FLUX), or Bobs LoRA Loader (Anima) depending on your base model.
  3. Connect your MODEL and CLIP outputs into the corresponding inputs on the node.
  4. Select the LoRA you wish to apply from the lora_name dropdown.
  5. Use the preset dropdown to quickly apply a set of block weights for a specific purpose (e.g., "Character" to focus on subject detail).
  6. For maximum control, set the preset to Custom and adjust the individual block sliders that appear.
  7. The main strength slider acts as a global multiplier for all other block weights, allowing you to scale the entire effect up or down.

Anima Loader Parameters

The Bobs LoRA Loader (Anima) groups matched LoRA tensors by their Anima/Cosmos Predict2 module names. These controls are practical tuning handles rather than hard scientific boundaries, but they map directly to the classifier in bobs_lora_loader.py.

Parameter Code mapping What it affects Overfit-taming tip
strength Global multiplier applied after the selected preset or custom sliders. Scales the whole LoRA effect up or down. Lower this first if everything is too strong. Try 0.7-0.9 before changing many block sliders.
preset Selects values from the ANIMA preset table unless set to Custom. Provides starting recipes such as full-strength, character-focused, style-focused, concept-focused, or anatomy-focused weighting. Use Custom when a LoRA is usable but carries too much memorized pose, lighting, outfit, or style.
Text Encoder Keys beginning with text_encoders_, lora_te_, or containing transformer_model_layers. Prompt/token interpretation and text-encoder LoRA weights, when present. Lower it if trigger words become too stubborn or the LoRA ignores prompt variation.
LLM Adapter Keys containing llm_adapter. Anima's bridge from Qwen text features into the diffusion model. This can strongly affect concept binding and character adherence. Keep moderate to high for character identity; lower it if the LoRA overbinds to one narrow concept.
Input & Time Embedding Keys containing x_embedder, t_embedder, t_embedding_norm, pos_embedder, or extra_pos_embedder. Initial latent/token embedding, timestep conditioning, and positional embedding. Lower it if the LoRA keeps forcing the same pose, crop, layout, or composition.
Early DiT Blocks (Composition) blocks.0 through blocks.7. Broad composition, framing, silhouette, large pose/shape decisions. Lower it when the LoRA memorizes composition or camera angle.
Middle DiT Blocks (Subject & Layout) blocks.8 through blocks.19; unmatched AdaLN modulation keys also fall here. Main subject structure, identity, anatomy, clothing, and concept layout. Usually keep this strongest for character LoRAs while reducing late/final blocks to avoid baked-in style.
Late DiT Blocks (Detail & Style) blocks.20 and above. Detail rendering, texture, line/shading style, and smaller visual traits. Lower it when images look crunchy, over-rendered, or too locked to the training style.
Final Output Layer Keys containing final_layer. Final latent projection from transformer features back to image latent space. Lower or zero it if the LoRA overbakes colors, contrast, texture, or final polish.
Other Tensors Any matched LoRA tensor not classified above. Fallback group for compatible weights that do not match the known Anima patterns. Leave at 1.0 unless logs show many tensors here and the LoRA behaves oddly.

Anima Starting Points

For an overfit character LoRA, start with:

strength: 0.7 - 0.9
Text Encoder: 0.4 - 0.8
LLM Adapter: 0.7 - 1.0
Input & Time Embedding: 0.2 - 0.5
Early DiT Blocks: 0.5 - 0.8
Middle DiT Blocks: 0.8 - 1.0
Late DiT Blocks: 0.2 - 0.5
Final Output Layer: 0.0 - 0.3
Other Tensors: 1.0

If a LoRA keeps forcing the same pose or composition, reduce Input & Time Embedding and Early DiT Blocks.

If a LoRA keeps forcing the same style, shading, or overbaked detail, reduce Late DiT Blocks and Final Output Layer.

If a LoRA loses the character or core concept, raise LLM Adapter and Middle DiT Blocks before raising the global strength.

Why Use Block-Weighted LoRA?

A single LoRA file often contains training for multiple concepts (e.g., a character's face, their clothing, and the overall artistic style). A standard LoRA loader applies the LoRA with one uniform strength across the entire model.

This can be limiting. For example:

  • You might want a character's features but not the stiff, overbaked style it was trained with.
  • You might want a LoRA's artistic style but not the character concepts embedded within it.

By assigning different strengths to different model blocks, you can selectively emphasize or de-emphasize these aspects. The SDXL loader provides coarse control over the main UNet stages, the FLUX loader offers finer-grained control over conceptual phases like "Composition," "Refinement," and "Final Textures," and the Anima loader separates text conditioning, Anima's LLM adapter, MiniTrainDIT block ranges, and final projection.

Changelog / What's New

Major Overhaul of LoRA Classification Logic

This version addresses a critical issue where many LoRA files were not being correctly categorized, causing a large number of weights to be ignored or misapplied. The core classification logic for both loaders has been completely rewritten.

  • FLUX Loader Fix: The loader's regular expressions and classification rules have been completely overhauled to correctly handle all block types, including complex time_text_embed keys and all layers within attention blocks (q, k, v, out).
  • SDXL Loader Fix: The loader is now compatible with LoRAs that use the unet. naming convention (common in some community models), in addition to the standard lora_unet_... format. This significantly improves compatibility.

The result is a far more reliable and robust tool that helps the settings on your sliders reflect the changes being applied to the model. The "Other Tensors" count in the logs should usually be low for supported LoRAs, but it may be non-zero when a LoRA includes compatible weights outside the known block naming patterns.

About

A custom LoRA loader node for ComfyUI with advanced block-weighting controls for SDXL, FLUX and Anima models. Features presets for common use-cases like 'Character' and 'Style', and a 'Custom' mode for fine-grained control over individual model blocks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%