MSdiffusion_Model_Loader
The Node That Does All the Heavy Lifting Before MS-Diffusion Can Generate
- clip_vision
- model
MSdiffusion_Model_Loader is the first node you'll touch in the MS-Diffusion pack, and it's doing far more than the name suggests. MS-Diffusion is a research method from a 2024 paper (arXiv 2406.07209) for multi-subject zero-shot personalization with layout guidance - you hand it a picture of your dog and a picture of your aunt, and it puts both in one image, each where you say, without training a LoRA. This node is the entire front half of that: it builds a full SDXL pipeline, wires up the adapter, and hands you one bundle that MSdiffusion_Sampler consumes.
If that sounds like a lot of machinery for one node - it is. That's the whole point of the pack: the author wrapped the whole thing so you don't have to think about diffusers pipelines, Resamplers, or adapters. The tradeoff is you don't get to peek inside either.
What it needs
Most of the load-in happens here, and it's heavier than your average loader:
ckpt_name- any SDXL checkpoint, loaded viafrom_single_file. This is a regular SDXL pipeline underneath, not a custom architecture.clip_vision- required. Any base from the CLIP-ViT-bigG-14-laion2B-39B-b160k family (the same image-encoder family IP-Adapter uses on SDXL). Wire in whatever your clip vision loader gives you.ms_adapter.bin- the trained MS-Diffusion adapter. You don't have to fetch it by hand anymore: the node auto-downloads it fromdoge1516/MS-Diffusionon HuggingFace intoComfyUI/models/photomaker/on first load (that's the "no longer needs an external network" fix in the changelog - it used to require manual download).- Optional extras:
vae_id, a single SDXLcontrolnet_ckpt, and alorawithlora_scale(default 0.8). Pick a ControlNet here and the sampler will expect a control image later. Pick a LoRA and it gets fused in, not just attached, so you can't dial it mid-graph.
The single output is an MSDIF_DICT named model - you can't read it, just plug it into the sampler.
How it works under the hood
Read the class and you see the whole pipeline: a StableDiffusionXLPipeline built from your single-file checkpoint, optional VAE swap, optional ControlNet conversion, LoRA fusion, and your chosen scheduler (19 options - Euler, DPM++, and friends). Then it attaches the MSAdapter: a CLIP image encoder plus a Resampler projection that turns each reference image into 16 query tokens the UNet attends to - the same IP-Adapter cross-attention trick, adapted for multiple subjects. Two things worth knowing before you use it:
- It always enables FreeU with fixed values (s1=0.6, s2=0.4, b1=1.1, b2=1.2), plus VAE slicing. There's no toggle. Your outputs carry that FreeU flavor whether you asked for it or not.
- The
scheduleryou pick here is the one used at sampling time. You don't set it again downstream.
Installing
The usual two ways:
- ComfyUI Manager → search "ComfyUI_MS_Diffusion" → install, restart.
- Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/smthemex/ComfyUI_MS_Diffusion
cd ComfyUI_MS_Diffusion
pip install -r requirements.txt
Here's the gotcha the README understates: the shipped requirements.txt only lists tensorboard, scipy, and PyYAML. The code imports diffusers, transformers, omegaconf, and safetensors directly. The author's advice is literally "缺啥装啥" - install whatever's missing. If the node dies on import, pip install diffusers transformers omegaconf safetensors is your fix. You'll also need your SDXL checkpoint, a CLIP vision model, and optionally an SDXL ControlNet in their usual ComfyUI/models/ folders.
This is a niche research port by smthemex, a prolific custom-node author. Expect to babysit dependencies a little, not a lot - but this isn't a polished product either. And if the loader raises "model error", it's the checkpoint path or the single-file parse that's wrong, not your prompt.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| clip_vision | CLIP_VISION | — | |
| ckpt_name | COMBO | 1 options: none | |
| vae_id | COMBO | 1 options: none | |
| controlnet_ckpt | COMBO | 1 options: none | |
| lora | COMBO | 1 options: none | |
| lora_scale | FLOAT | 0.80.1–1 | — |
| trigger_words | STRING | best quality | — |
| scheduler | COMBO | 19 options: Euler, Euler a, DDIM, DDPM, DPM++ 2M, DPM++ 2M Karras, +13 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| model | MSDIF_DICT | — |