FreeFuse

yaoliliuApache-2.0活跃维护

多主体 LoRA 融合方法,在测试时通过自适应 token 级路由把多个 LoRA 组合起来,让扩散模型一次生成多个指定主体。

[TMLR26]FreeFuse: Multi-Subject LoRA Fusion via Adaptive Token-Level Routing at Test Time

暂无版本250star +1 / 7 天23fork同步于 2026-11-10 18:04 UTC

怎么上手

由 README 提炼,执行前请确认
pip install comfy-cli
comfy node install freefuse
# 或 diffusers 方式:git clone https://github.com/yaoliliu/FreeFuse.git && git lfs pull && uv venv && source .venv/bin/activate && uv sync
硬件要求按 README 说明

README 未给出具体显存数值;脚本内可把 quantization 变量设为 True 以降低显存占用,显存不足时使用。支持在 Flux、SDXL、Z-Image-turbo 等模型上运行,未列明 GPU 厂商与型号。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

免训练多主体 LoRA 融合工具,用自适应 token 路由解决多个主体 LoRA 的特征冲突

多主体 LoRA 融合方法,在测试时通过自适应 token 级路由把多个 LoRA 组合起来,让扩散模型一次生成多个指定主体。

核心能力

  • 用 FreeFuseAttn 在早期去噪步把主体 token 动态匹配到空间区域
  • 无需额外训练、改模型或用户手画 mask,只给主体激活词
  • 支持 Flux、SDXL、Z-Image-turbo、FLUX.2-klein、Krea2 等模型
  • 可叠加 ControlNet、IP-Adapter、Redux 与背景识别
  • 提供 ComfyUI 节点与 diffusers 两套推理脚本

容易踩的坑

示例 LoRA 需通过 git lfs pull 或 hf download lsmpp/freefuse_example_loras 单独下载;diffusers 方式依赖 uv 创建虚拟环境并同步依赖;显存不足时需手动把脚本里的 quantization 变量改为 True。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    FreeFuse: Multi-Subject LoRA Fusion via Adaptive Token-Level Routing at Test Time

    arXiv

    📌 TODO

    • Release basic inference code
    • Release inference code for controlnet, ipadapter and redux
    • Supports ComfyUI
    • Supports Z-Image-turbo in diffusers
    • Supports Z-Image-turbo in ComfyUI
    • Supports FLUX.2-klein-4B/9B in diffusers
    • Supports FLUX.2-klein-4B/9B in ComfyUI
    • Supports Krea2 in ComfyUI
    • Experimental MOSS Image Base/SFT support in Diffusers and ComfyUI
    • Anima Base v1.0 support in ComfyUI
    • Support ControlNet+FreeFuse in ComfyUI
    • Native MiniMax H3 text-to-audio-video support in ComfyUI

    📖 Abstract

    This paper proposes FreeFuse, a training-free framework for multi-subject text-to-image generation through automatic fusion of multiple subject LoRAs. In contrast to prior studies that focus on retraining LoRA to alleviate feature conflicts, our analysis reveals that simply spatially confining the subject LoRA's output to its target region and preventing other LoRAs from directly intruding into this area is sufficient for effective mitigation. Accordingly, we implement Adaptive Token-Level Routing during the inference phase. We introduce FreeFuseAttn, a mechanism that exploits the flow matching model's intrinsic semantic alignment to dynamically match subject-specific tokens to their corresponding spatial regions at early denoising timesteps, thereby bypassing the need for external segmentors. FreeFuse distinguishes itself through high practicality: it necessitates no additional training, model modifications, or user-defined masks spatial conditions. Users need only provide subject activation words to achieve seamless integration into standard workflows. Extensive experiments validate that FreeFuse outperforms existing approaches in both identity preservation and compositional fidelity.

    🎨 Results

    Results on Flux.dev

    Results on SDXL

    🏗️ Architecture

    🚀 Quick Start

    Installation with ComfyUI

    # use comfy-cli
    pip install comfy-cli
    comfy node install freefuse
    
    # or manual installation
    cd <your ComfyUI path>/custom_nodes
    git clone --depth 1 --branch comfyui https://github.com/yaoliliu/FreeFuse.git freefuse_comfyui
    

    You can find example workflows in the freefuse_comfyui/workflows folder, including the MiniMax H3 video comparison workflow.

    Installation with diffusers

    You just need clone this repo and use uv to install dependencies.

    apt-get update && apt-get install -y git-lfs && git lfs install
    git clone https://github.com/yaoliliu/FreeFuse.git
    git lfs pull
    # or using huggingface if lfs budget is used up
    hf download lsmpp/freefuse_example_loras --local-dir=./loras
    
    uv venv
    source .venv/bin/activate
    uv sync
    

    Running on Flux

    without background identification

    python main_freefuse_flux.py
    

    with background identification and style LoRA

    python main_freefuse_flux_bg_except.py
    

    with redux

    python redux_freefuse_flux_bg_except.py
    

    with ipadapter

    python ipadapter_freefuse_flux_bg_except.py
    

    with controlnet

    python controlnet_freefuse_flux_bg_except.py
    

    If you running out of your vram, you can set the quantization variable in the script to 'True' to enable quantization, which will reduce the vram usage.

    Running on SDXL

    python main_freefuse_sdxl.py
    

    Running on Z-Image-turbo

    python main_freefuse_z_image.py
    

    Acknowledgement

    Thanks for Tekemo and jrewingwannabe947's ZIT LoRAs, which are used in our Z-Image-turbo examples.

    Thanks to gpl1967 and merermero for the Krea2 support request and discussion in issue #26.

    Thanks to Rudolf (GPL1967) and Agent Cow (monomatic, Hamburg) for contributing the Krea2 AutoPrompt and depth-control workflow in PR #32.

    Thanks to mertkasar for identifying the bypass LoRA token-masking issue and sharing a proposed fix in issue #34.

    More model comparisons

    Single-LoRA character references are shown at the left of each row. See reference generation settings.

    Results on MiniMax H3 video (ComfyUI)

    Single-LoRA references, generated separately with single-character prompts (seed 42):

    Starfire · Teen Titans LoRA onlyAlbedo · Albedo LoRA only
    Starfire single-LoRA referenceAlbedo single-LoRA reference

    https://github.com/user-attachments/assets/401615de-1685-4e76-8975-03529ce28443

    Global LoRAs on the left; automatic FreeFuse on the right, with the same prompt, seed and sampling settings. This preview is silent; the native workflow generates 768 × 768 videos with 124 frames and audio. See the H3 workflow and model setup.