Stable Diffusion recipe merger
Project description
sd-mecha
sd-mecha is a stable diffusion recipe merger:
import sd_mecha
# plan a simple weighted sum
merge = sd_mecha.weighted_sum(
"ghostmix_v20Bakedvae",
"dreamshaper_332BakedVaeClipFix",
alpha=0.5,
)
# scheduler contains default parameters
scheduler = sd_mecha.MergeScheduler(
base_dir=r"E:\sd\models\Stable-diffusion",
device="cuda:0",
prune=True,
)
# perform the entire merge plan and save to output path
scheduler.merge_and_save(merge, output_path="basic_merge")
See the examples directory for other examples.
Motivation
Keeping track of full merge recipes has always been annoying. I needed something that allows to store merge recipes in a readable format while also being executable. I also needed something that allows to fully merge an entire tree of models without having to save intermediate models to disk.
Install
pip install sd-mecha torch tensordict
sd-mecha depends additionally on:
torch>=2.0.1
tensordict
The pypi package does not ship with torch
nor tensordict
so that you can install the appropriate version for your system.
Acknowledgements
This code is heavily based on the sd-meh library.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sd-mecha-0.0.1.tar.gz
(22.7 kB
view hashes)
Built Distribution
sd_mecha-0.0.1-py3-none-any.whl
(24.4 kB
view hashes)