Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75a91710f2 | ||
|
|
f8eea61264 | ||
|
|
e42d3b0426 | ||
|
|
ee567b14e8 | ||
|
|
10a790974c | ||
|
|
00d2eb9885 | ||
|
|
b1139f285a | ||
|
|
eb69a21cf2 | ||
|
|
c863ade839 | ||
|
|
b07ed256c7 | ||
|
|
612cfb51f2 | ||
|
|
34d36e3c93 |
@@ -7,14 +7,18 @@ on:
|
||||
paths:
|
||||
- "pyproject.toml"
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
publish-node:
|
||||
name: Publish Custom Node to registry
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'scraed' }}
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
- name: Publish Custom Node
|
||||
uses: Comfy-Org/publish-node-action@main
|
||||
uses: Comfy-Org/publish-node-action@v1
|
||||
with:
|
||||
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }} ## Add your own personal access token to your Github Repository secrets and reference it here.
|
||||
@@ -21,6 +21,8 @@ LanPaint introduces **two-way alignment** between masked and unmasked areas. It
|
||||
Based on this evaluation, LanPaint iteratively updates the noise in both the masked and unmasked regions.
|
||||
|
||||
## Updates
|
||||
- 2025/04/16
|
||||
- Added Primary HiDream support
|
||||
- 2025/03/22
|
||||
- Added Primary Flux support
|
||||
- Added Tease Mode
|
||||
@@ -30,6 +32,19 @@ Based on this evaluation, LanPaint iteratively updates the noise in both the mas
|
||||
## Example Results
|
||||
All examples use a random seed 0 to generate batch of 4 images for fair comparison. (Warning: Generating 4 images may exceed your GPU memory; adjust batch size as needed.)
|
||||
|
||||
|
||||
### Example HiDream: InPaint(LanPaint K Sampler, 5 steps of thinking)
|
||||

|
||||
[View Workflow & Masks](https://github.com/scraed/LanPaint/tree/master/examples/Example_8)
|
||||
|
||||
You need to install [ComfyUI GGUF](https://github.com/city96/ComfyUI-GGUF) in order to load the models. Make sure you have the latest (nightly at 2025/04/16) comfyui installed. The following models are needed for Hidream:
|
||||
- [clip_g_hidream.safetensors](https://huggingface.co/Comfy-Org/HiDream-I1_ComfyUI/blob/main/split_files/text_encoders/clip_g_hidream.safetensors)
|
||||
- [clip_l_hidream.safetensors](https://huggingface.co/Comfy-Org/HiDream-I1_ComfyUI/blob/main/split_files/text_encoders/clip_l_hidream.safetensors)
|
||||
- [T5 GGUF](https://huggingface.co/city96/t5-v1_1-xxl-encoder-gguf/tree/main)
|
||||
- [Llama 3.1](https://huggingface.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF/tree/main)
|
||||
- [Flux VAE](https://huggingface.co/StableDiffusionVN/Flux/blob/main/Vae/flux_vae.safetensors)
|
||||
|
||||
|
||||
### Example 1: Basket to Basket Ball (LanPaint K Sampler, 2 steps of thinking).
|
||||

|
||||
[View Workflow & Masks](https://github.com/scraed/LanPaint/tree/master/examples/Example_1)
|
||||
@@ -67,7 +82,10 @@ All examples use a random seed 0 to generate batch of 4 images for fair comparis
|
||||
[Model Used in This Example](https://huggingface.co/Comfy-Org/flux1-dev/blob/main/flux1-dev-fp8.safetensors)
|
||||
(Note: Use CFG scale 1.0 for Flux as it don't use CFG. LanPaint_cfg_BIG is also disabled on Flux)
|
||||
|
||||
**How to Use These Examples:**
|
||||
|
||||
|
||||
|
||||
## **How to Use These Examples:**
|
||||
1. Navigate to the **example** folder (i.e example_1) by clicking **View Workflow & Masks**, download all pictures.
|
||||
2. Drag **InPainted_Drag_Me_to_ComfyUI.png** into ComfyUI to load the workflow.
|
||||
3. Download the required model from Civitai by clicking **Model Used in This Example**.
|
||||
@@ -166,6 +184,19 @@ For challenging inpainting tasks:
|
||||
|
||||
Help us improve LanPaint! 🚀 **Report bugs**, share **example cases**, or contribute your **personal parameter settings** to benefit the community.
|
||||
|
||||
## Citation
|
||||
|
||||
```
|
||||
@misc{zheng2025lanpainttrainingfreediffusioninpainting,
|
||||
title={Lanpaint: Training-Free Diffusion Inpainting with Exact and Fast Conditional Inference},
|
||||
author={Candi Zheng and Yuan Lan and Yang Wang},
|
||||
year={2025},
|
||||
eprint={2502.03491},
|
||||
archivePrefix={arXiv},
|
||||
primaryClass={eess.IV},
|
||||
url={https://arxiv.org/abs/2502.03491},
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 601 KiB |
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "LanPaint"
|
||||
version = "0.2.0"
|
||||
version = "0.2.2"
|
||||
description = "Achieve seamless inpainting results without needing a specialized inpainting model."
|
||||
authors = [
|
||||
{name = "LanPaint", email = "czhengac@connect.ust.hk"}
|
||||
|
||||
@@ -85,9 +85,10 @@ class KSamplerX0Inpaint:
|
||||
# x is rectified flow x_t = sigma * noise + (1.0 - sigma) * x_0
|
||||
|
||||
IS_FLUX = self.inner_model.inner_model.model_type == ModelType.FLUX
|
||||
IS_FLOW = self.inner_model.inner_model.model_type == ModelType.FLOW
|
||||
|
||||
# unify the notations into variance exploding diffusion model
|
||||
if IS_FLUX:
|
||||
if IS_FLUX or IS_FLOW:
|
||||
LanPaint_Sigma = sigma / ( torch.maximum( 1 - sigma , sigma*0 + 5e-2 ))
|
||||
self.LanPaint_Sigmas = self.sigmas / ( torch.maximum( 1 - self.sigmas , self.sigmas*0 + 5e-2 ))
|
||||
else:
|
||||
@@ -130,7 +131,7 @@ class KSamplerX0Inpaint:
|
||||
# self.inner_model.inner_model.scale_latent_inpaint returns variance exploding x_t values
|
||||
x = x * (1 - latent_mask) + self.inner_model.inner_model.scale_latent_inpaint(x=x, sigma=sigma, noise=self.noise, latent_image=self.latent_image)* latent_mask
|
||||
|
||||
if IS_FLUX:
|
||||
if IS_FLUX or IS_FLOW:
|
||||
x_t = x * ( 1 + LanPaint_Sigma[:, None,None,None])
|
||||
else:
|
||||
x_t = x #/ ( 1+sigma**2 )**0.5 # switch to variance perserving x_t values
|
||||
@@ -149,7 +150,7 @@ class KSamplerX0Inpaint:
|
||||
else:
|
||||
step_size_i = step_size
|
||||
x_t, args = self.langevin_dynamics(x_t, score_func , latent_mask, step_size_i , current_times, sigma_x = self.sigma_x(abt)[:, None,None,None], sigma_y = self.sigma_y(abt)[:, None,None,None], args = args)
|
||||
if IS_FLUX:
|
||||
if IS_FLUX or IS_FLOW:
|
||||
x = x_t / ( 1 + LanPaint_Sigma[:, None,None,None] )
|
||||
else:
|
||||
x = x_t #/ ( 1+sigma**2 )**0.5 # switch to variance perserving x_t values
|
||||
@@ -190,7 +191,8 @@ class KSamplerX0Inpaint:
|
||||
beta = self.chara_beta * (1-abt)**0.5
|
||||
|
||||
IS_FLUX = self.inner_model.inner_model.model_type == ModelType.FLUX
|
||||
if IS_FLUX:
|
||||
IS_FLOW = self.inner_model.inner_model.model_type == ModelType.FLOW
|
||||
if IS_FLUX or IS_FLOW:
|
||||
x_0, x_0_BIG = self.inner_model(x_t / ( 1 + sigma ), sigma[:, 0,0,0] / ( 1 + sigma[:, 0,0,0] ), model_options=model_options, seed=seed)
|
||||
else:
|
||||
x_0, x_0_BIG = self.inner_model(x_t, sigma[:, 0,0,0], model_options=model_options, seed=seed)
|
||||
|
||||
Reference in New Issue
Block a user