| --- |
| license: apache-2.0 |
| --- |
| |
| <div align="center"> |
|
|
| ## Controllable Layer Decomposition for Reversible Multi-Layer Image Generation |
|
|
| π [Homepage](https://monkek123King.github.io/CLD_page) Β Β Β Β π [Paper](http://arxiv.org/abs/2511.16249) Β Β Β Β π€ [HuggingFace](https://huggingface.co/papers/2511.16249) |
|
|
|
|
| </div> |
|
|
|
|
| ### π’ News |
|
|
| * **`Dec 2025`:** Experiment checkpoints are released [here](https://huggingface.co/thuteam/CLD)\! π |
| * **`Nov 2025`:** The paper is now available on [arXiv](https://arxiv.org/abs/2511.16249). βοΈ |
|
|
| ----- |
|
|
| ## π Getting Started |
|
|
| ### π§ Installation |
|
|
| **a. Create a conda virtual environment and activate it.** |
| ```shell |
| conda env create -f environment.yml |
| conda activate CLD |
| ``` |
|
|
| **b. Clone CLD.** |
| ``` |
| git clone https://github.com/monkek123King/CLD.git |
| ``` |
|
|
| ### π¦ Prepare model ckpt |
| **a. Download FLUX.1-dev weights** |
| ``` |
| from huggingface_hub import snapshot_download |
| |
| repo_id = "black-forest-labs/FLUX.1-dev" |
| snapshot_download(repo_id, local_dir=Path_to_pretrained_FLUX_model) |
| ``` |
|
|
| **b.Download adapter pre-trained weights** |
| ``` |
| from huggingface_hub import snapshot_download |
| |
| repo_id = "alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha" |
| snapshot_download(repo_id, local_dir=Path_to_pretrained_FLUX_adapter) |
| ``` |
|
|
| **c. Download LoRA weights for CLD from https://huggingface.co/thuteam/CLD** |
| ``` |
| ckpt |
| βββ decouple_LoRA |
| βΒ Β βββ adapter |
| βΒ Β βΒ Β βββ pytorch_lora_weights.safetensors |
| βΒ Β βββ layer_pe.pth |
| βΒ Β βββ transformer |
| βΒ Β βββ pytorch_lora_weights.safetensors |
| βββ pre_trained_LoRA |
| βΒ Β βββ pytorch_lora_weights.safetensors |
| βββ prism_ft_LoRA |
| βΒ Β βββ pytorch_lora_weights.safetensors |
| βββ trans_vae |
| βββ 0008000.pt |
| ``` |
|
|
| **d. YAML configuration file** |
| ``` |
| pretrained_model_name_or_path: Path_to_pretrained_FLUX_model |
| pretrained_adapter_path: Path_to_pretrained_FLUX_adapter |
| transp_vae_path: "ckpt/trans_vae/0008000.pt" |
| pretrained_lora_dir: "ckpt/pre_trained_LoRA" |
| artplus_lora_dir: "ckpt/prism_ft_LoRA" |
| lora_ckpt: "ckpt/decouple_LoRA/transformer" |
| layer_ckpt: "ckpt/decouple_LoRA" |
| adapter_lora_dir: "ckpt/decouple_LoRA/adapter" |
| ``` |
|
|
|
|
| ### ποΈ Train and Evaluate |
|
|
| **Train** |
|
|
| ``` |
| python -m train.train -c train/train.yaml |
| ``` |
|
|
| **Infer** |
| ``` |
| python -m infer.infer -c infer/infer.yaml |
| ``` |
|
|
| **Eval** |
|
|
| Prepare the ground-truth samples. |
| ``` |
| python -m eval.prepare_gt |
| ``` |
|
|
| Evaluate to obtain the metric results. |
| ``` |
| python evaluate.py --pred-dir "Path_to_predict_results" --gt-dir "Path_to_gt_samples" --output-dir "Path_to_save_eval_results" |
| ``` |
|
|
| ----- |
|
|
| ## βοΈ Citation |
|
|
| If you find our work useful for your research, please consider citing our paper and giving this repository a star π. |
|
|
| ```bibtex |
| @article{liu2025controllable, |
| title={Controllable Layer Decomposition for Reversible Multi-Layer Image Generation}, |
| author={Liu, Zihao and Xu, Zunnan and Shu, Shi and Zhou, Jun and Zhang, Ruicheng and Tang, Zhenchao and Li, Xiu}, |
| journal={arXiv preprint arXiv:2511.16249}, |
| year={2025} |
| } |
| ``` |