Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
IrisRainbowNeko c81cdb8f7f | 1 month ago | |
---|---|---|
.github/workflows | 1 year ago | |
.idea | 2 months ago | |
cfgs | 1 month ago | |
doc | 2 months ago | |
embs | 1 year ago | |
hcpdiff | 1 month ago | |
imgs | 9 months ago | |
prompt_tuning_template | 1 year ago | |
.editorconfig | 10 months ago | |
.gitignore | 10 months ago | |
.readthedocs.yml | 8 months ago | |
LICENSE | 1 year ago | |
README.md | 8 months ago | |
README_cn.md | 8 months ago | |
config.py | 1 year ago | |
requirements.txt | 2 months ago | |
setup.py | 2 months ago |
HCP-Diffusion is a toolbox for Stable Diffusion models based on 🤗 Diffusers.
It facilitates flexiable configurations and component support for training, in comparison with webui and sd-scripts.
This toolbox supports Colossal-AI, which can significantly reduce GPU memory usage.
HCP-Diffusion can unify existing training methods for text-to-image generation (e.g., Prompt-tuning, Textual Inversion, DreamArtist, Fine-tuning, DreamBooth, LoRA, ControlNet, etc) and model structures through a single .yaml
configuration file.
The toolbox has also implemented an upgraded version of DreamArtist with LoRA, named DreamArtist++, for one-shot text-to-image generation.
Compared to DreamArtist, DreamArtist++ is more stable with higher image quality and generation controllability, and faster training speed.
Install with pip:
pip install hcpdiff
# Start a new project and make initialization
hcpinit
Install from source:
git clone https://github.com/7eu7d7/HCP-Diffusion.git
cd HCP-Diffusion
pip install -e .
# Modified based on this project or start a new project and make initialization
## hcpinit
To use xFormers to reduce VRAM usage and accelerate training:
# use conda
conda install xformers -c xformers
# use pip
pip install xformers>=0.0.17
Training scripts based on 🤗 Accelerate or Colossal-AI are provided.
# with Accelerate
accelerate launch -m hcpdiff.train_ac --cfg cfgs/train/cfg_file.yaml
# with Accelerate and only one GPU
accelerate launch -m hcpdiff.train_ac_single --cfg cfgs/train/cfg_file.yaml
# with Colossal-AI
# pip install colossalai
torchrun --nproc_per_node 1 -m hcpdiff.train_colo --cfg cfgs/train/cfg_file.yaml
python -m hcpdiff.visualizer --cfg cfgs/infer/cfg.yaml pretrained_model=pretrained_model_path \
prompt='positive_prompt' \
neg_prompt='negative_prompt' \
seed=42
The framework is based on 🤗 Diffusers. So it needs to convert the original Stable Diffusion model into a supported format using the scripts provided by 🤗 Diffusers.
python -m hcpdiff.tools.sd2diffusers \
--checkpoint_path "path_to_stable_diffusion_model" \
--original_config_file "path_to_config_file" \
--dump_path "save_directory" \
[--extract_ema] # Extract EMA model
[--from_safetensors] # Whether the original model is in safetensors format
[--to_safetensors] # Whether to save to safetensors format
Convert VAE:
python -m hcpdiff.tools.sd2diffusers \
--vae_pt_path "path_to_VAE_model" \
--original_config_file "path_to_config_file" \
--dump_path "save_directory"
[--from_safetensors]
You are welcome to contribute more models and features to this toolbox!
This toolbox is maintained by HCP-Lab, SYSU.
@article{DBLP:journals/corr/abs-2211-11337,
author = {Ziyi Dong and
Pengxu Wei and
Liang Lin},
title = {DreamArtist: Towards Controllable One-Shot Text-to-Image Generation
via Positive-Negative Prompt-Tuning},
journal = {CoRR},
volume = {abs/2211.11337},
year = {2022},
doi = {10.48550/arXiv.2211.11337},
eprinttype = {arXiv},
eprint = {2211.11337},
}
No Description
Python Text Markdown
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》