home/ atoms/ lora-stacking-in-realtime-diffusion

Multiple LoRA weights can be loaded and fused into StreamDiffusion before inference for style mixing

StreamDiffusion’s wrapper accepts a lora_dict argument: a Python dict mapping LoRA file paths (local or HuggingFace IDs) to weight scales. At load time, each LoRA is loaded with stream.load_lora(name) and immediately fused with stream.fuse_lora(lora_scale=scale). Fusing burns the LoRA delta into the base weights at init time, eliminating adapter overhead during inference. Multiple fusions are cumulative. The lora_scale value (0.0–1.0+) controls contribution strength, allowing soft blending between a base model and one or more style LoRAs. This differs from runtime LoRA switching: in StreamDiffusion, LoRAs are fixed at pipeline construction to keep the inference loop free of weight manipulation.

Examples

StreamDiffusionWrapper(
    model_id_or_path='KBlueLeaf/kohaku-v2.1',
    lora_dict={
        'path/to/anime-style.safetensor': 0.7,
        'path/to/oil-paint.safetensor': 0.4,
    },
    ...
)

Assessment

If a performer wants to switch between two LoRA styles mid-set without restarting the pipeline, is that possible with the current StreamDiffusion architecture? Explain why or why not, citing how fuse_lora works.

“Keys are the LoRA names and values are the LoRA scales. Example: {'LoRA_1' : 0.5 , 'LoRA_2' : 0.7 ,...}”
corpus · streamdiffusion-pipeline-for-real-time-interactive-image-gen · chunk 61