PedroMarinhoDev's picture
The node pack also runs MOSS-Image-Edit-HQ v5
908d630 verified
|
Raw History Blame Contribute Delete
5.16 kB
---
license: gpl-3.0
base_model: OpenMOSS-Team/MOSS-Image-SFT
base_model_relation: adapter
pipeline_tag: image-to-image
library_name: comfyui
tags:
- lora
- comfyui
- image-editing
- moss-image
---
# Moss-Image-Edit LoRA for ComfyUI
[chinoll/Moss-Image-Edit](https://huggingface.co/chinoll/Moss-Image-Edit), the image-editing LoRA for
[MOSS-Image](https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT), with its keys renamed for ComfyUI's native
MOSS-Image model. Edit an image (or combine up to four) with a text instruction.
**[Watch the overview (62 s)](https://huggingface.co/PedroMarinhoDev/Moss-Image-Edit-ComfyUI/resolve/main/moss-image-edit-promo.mp4)**
· [Gallery with every prompt](https://github.com/PedroMarinhoDev/ComfyUI-Moss-Image-Edit-Native#gallery)
![14 edit types, two seeds](assets/results_chinoll_sft.jpg)
*14 common edit types (after the GEdit-Bench and ImgEdit categories) on MOSS-Image SFT at 1024 px, CFG 5, layer 22
skipped on the negative pass; columns: source, seed 42, seed 7. Sources made with FLUX.2 Klein 9B.*
## Use
Install the node pack **[ComfyUI-Moss-Image-Edit-Native](https://github.com/PedroMarinhoDev/ComfyUI-Moss-Image-Edit-Native)**
(stock ComfyUI loaders, `LoraLoaderModelOnly`, samplers and memory management; no diffusers or transformers) and open a
workflow from Templates → ComfyUI-Moss-Image-Edit-Native. The pack also runs
[akhaliq/MOSS-Image-Edit-HQ](https://huggingface.co/akhaliq/MOSS-Image-Edit-HQ) v3 and v5, in their own ai-toolkit
layout (v5 with the 512 px vision it was trained with); the node pack's README compares all three.
ComfyUI master can also run this LoRA itself (Text Encode MOSS-Image Edit, `edit_format` Moss-Image-Edit); that isn't in
a release yet, and the node pack works on the 0.42 releases and on master.
| folder | file |
|:--|:--|
| `loras` | [`moss_image_edit_lora_bf16.safetensors`](moss_image_edit_lora_bf16.safetensors) (this repo) |
| `diffusion_models` | `moss_image_sft_bf16` or `moss_image_sft_int8_convrot` from [Comfy-Org/MOSS-Image](https://huggingface.co/Comfy-Org/MOSS-Image) |
| `text_encoders` | `qwen3.5_9b_w4a8_gptq` from Comfy-Org/MOSS-Image, or a bf16 Qwen3.5-9B |
| `vae` | `flux2-vae_small` from Comfy-Org/MOSS-Image, or `flux2-vae` (same encoder) |
```bash
hf download PedroMarinhoDev/Moss-Image-Edit-ComfyUI moss_image_edit_lora_bf16.safetensors --local-dir ComfyUI/models/loras
```
## Settings
Tested on the RTX 3090: one change at a time on 7 edit types, then 14 edit types on SFT and Base with two seeds.
- **LoRA strength 1.0.** Below it the scene is redrawn instead of edited, removals don't happen and two-image edits
return image 2: ![strength 0.25 to 1.0](assets/strength.jpg)
- **References and output the same size.** The LoRA was trained with source and target at one size (256 px); with
smaller references than the output the scene zooms out or the edit fails. The nodes' default (`reference_max_edge`
and `output_max_edge` 0) takes care of it: each image becomes a ~1 MP bucket of its own aspect ratio, and the output
follows image 1: ![reference vs output size](assets/size_match.jpg)
- **CFG 5**, 30 steps, euler / simple, layer 22 skipped on the negative pass (the official MOSS sampler default), empty
negative. At CFG 4 removals also take nearby objects. (The HQ LoRA works best at CFG 3.)
- **MOSS-Image SFT, not Base.** The LoRA was trained on SFT; on Base text, subject replacement and two-image edits fail
much more often: ![SFT vs Base](assets/sft_vs_base.jpg)
- Weak spots on SFT too: pose changes and replacing one subject with another (it often adds the new one beside the old).
- `kv_cache` auto (the default) computes the reference images once per run instead of at every step.
## What changed
Only the key names; the tensors are the original bf16 values.
| | original `adapter_model.safetensors` | this file |
|:--|:--|:--|
| keys | `layers.N.proj.X.lora_A` / `.lora_B` | `diffusion_model.layers.N.proj.X.lora_A.weight` / `.lora_B.weight` / `.alpha` |
| scale | alpha / rank from `adapter_config.json` | `alpha` = 64 per module (rank 64, scale 1.0) |
| targets | q, k, v, o, ffn_up_gate, ffn_down of all 42 blocks (252 linears) | same; ComfyUI maps q/k/v onto the fused `qkv` of the int8 files |
| sha256 | `17a48b8c605dcffdedb92a2b887d18cf316505be90802717669fb6556098dcdf` (revision `e19b6ab`, unchanged in the republished `3be9c40`) | `f4bf2905dd40ae490ffda37d6be717f3361a4a723225cf0bf1f3b941eb03315d` |
Made with `tools/convert_lora.py` from the node pack, which checks the checksum, targets, shapes and rank/alpha. The
original adapter config is kept in the file's metadata (`adapter_config`).
## Credits and license
The LoRA was trained and released by [chinoll](https://huggingface.co/chinoll) / [Chenkin-x](https://github.com/Chenkin-x)
([Moss-Image-Edit](https://github.com/Chenkin-x/Moss-Image-Edit), released under GPLv3) on
[MOSS-Image](https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT) by OpenMOSS (Apache-2.0). The original model repo
names no separate license for the weights; this copy follows the project's GPL-3.0. All credit for the training goes
to the original authors.