MCPcopy Index your code
hub / github.com/FireRedTeam/LayerDiffuse-Flux

github.com/FireRedTeam/LayerDiffuse-Flux @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
49 symbols 173 edges 4 files 5 documented · 10%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

LayerDiffuse-Flux

This repo is a Flux version implementation of LayerDiffuse (LayerDiffuse).

We train a new transparent vae to adapt to Flux and train a lora to finetune Flux to generate transparent images.

## Installation
  • Clone this repository.
git clone https://github.com/RedAIGC/Flux-version-LayerDiffuse.git
cd Flux-version-LayerDiffuse
conda create -n flux_layer python=3.10 -y
conda activate flux_layer
pip install torch==2.3.0 torchvision==0.18.0 --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt
  • download weights
huggingface-cli download --resume-download --local-dir ./models RedAIGC/Flux-version-LayerDiffuse 
  • Make sure that you have the following directory structure.
Flux-version-LayerDiffuse/
| - imgs
| - lib_layerdiffuse
| - models
    | - layerlora.safetensors
    | - TransparentVAE.pth
| ...

Flux Transparent T2I

demo

python demo_t2i.py --ckpt_path /your/path/to/FLUX.1_dev --prompt /your/prompt

examples

Examples: top to bottom: flux, flux-layer(ours), sdxl, sdxl-layer(LayerDiffuse)

Flux Transparent I2I

python demo_i2i.py --ckpt_path /your/path/to/FLUX.1_dev --image "./imgs/causal_cut.png" --prompt /your/prompt

Prompt: "a handsome man with curly hair, high quality"

Strength: 0.9

Input (Transparent image) Output (Transparent image)
img img

Acknowledgements

Thanks lllyasviel for their great work LayerDiffuse You can use style RGBA image to finetune the network to get better results.

Contact

If you have any questions about the code, please do not hesitate to contact us!

Email: sunshuang1@xiaohongshu.com, xiangqiang1601@163.com

Core symbols most depended-on inside this repo

decode
called by 6
lib_layerdiffuse/vae.py
encode
called by 5
lib_layerdiffuse/vae.py
_unpack_latents
called by 3
lib_layerdiffuse/pipeline_flux_img2img.py
retrieve_latents
called by 2
lib_layerdiffuse/pipeline_flux_img2img.py
zero_module
called by 2
lib_layerdiffuse/vae.py
pad_rgb
called by 2
lib_layerdiffuse/vae.py
dist_sample_deterministic
called by 2
lib_layerdiffuse/vae.py
generate_img
called by 1
demo_i2i.py

Shape

Method 33
Function 10
Class 6

Languages

Python100%

Modules by API surface

lib_layerdiffuse/vae.py27 symbols
lib_layerdiffuse/pipeline_flux_img2img.py20 symbols
demo_t2i.py1 symbols
demo_i2i.py1 symbols

For agents

$ claude mcp add LayerDiffuse-Flux \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact