ComfyUI-Musubi-Tuner-LoRA-Loader
A ComfyUI custom node that enables direct loading of musubi-tuner based LoRAs (Z-Image Turbo, Hunyuan Video 1.5) with automatic in-memory conversion and caching.
ComfyUI Musubi-Tuner LoRA Loader
A ComfyUI custom node that enables direct loading of musubi-tuner based LoRAs without manual format conversion. The conversion happens automatically in-memory during node execution.
Features
- On-the-fly Conversion: Automatically converts musubi-tuner LoRA format to ComfyUI-compatible diffusers format
- No File Creation: All conversion happens in-memory, no temporary files needed
- Multi-Format Support:
- Qwen-Image LoRAs
- Z-Image Turbo LoRAs
- Hunyuan Video 1.5 LoRAs
- FLUX LoRAs
- Wan2.1 LoRAs
- ComfyUI v3 Schema: Uses the latest ComfyUI extension API
Installation
-
Navigate to your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes/ -
Clone this repository:
git clone https://github.com/vjumpkung/ComfyUI-Musubi-Tuner-LoRA-Loader.git -
Restart ComfyUI or reload custom nodes
Usage
- Find the node in ComfyUI under the name "musubi-tuner LoRA Loader"
- Connect a MODEL input
- Select your musubi-tuner format LoRA from the dropdown
- Adjust the strength_model parameter (default: 1.0, range: -100.0 to 100.0)
- Connect the MODEL output to your workflow
How It Works
The node converts musubi-tuner LoRA format to diffusers-compatible format using a comprehensive mapping system:
1. Format Detection and Module Name Mapping
The conversion automatically detects the LoRA format based on key patterns:
- Qwen-Image: Uses predefined key mappings for transformer blocks
- Z-Image: Detects
.attention.to.and.feed.forward.patterns - Hunyuan Video/FLUX: Detects
double.blocks.andsingle.blocks.patterns - Wan2.1: Detects
.cross.attn.and.self.attn.patterns
2. Key Transformation
Converts musubi-tuner naming conventions to diffusers format:
- Replaces underscores with dots for module hierarchy
- Applies format-specific fixes (e.g.,
to.q→to_q,img.→img_) - Maps to diffusers structure:
lora_down→lora_A.weight,lora_up→lora_B.weight
3. Alpha Scaling
Applies LoRA alpha scaling to weights:
- Scales both down and up weights by
sqrt(alpha / dim) - Ensures proper weight magnitude for model integration
Technical Details
- API Version: Built with ComfyUI v3 Schema API (
comfy_api.latest) - Base Class: Implements
io.ComfyNodewithdefine_schema()andexecute()methods - Extension System: Uses
ComfyExtensionandcomfy_entrypoint()for registration - Optimization: Returns original model immediately if
strength_model == 0 - Dependencies:
torch,tqdm,comfy.sd,comfy.utils,folder_paths
Credits
Conversion logic adapted from musubi-tuner by kohya-ss
License
This project is provided as-is for use with ComfyUI.