File size: 2,166 Bytes
b90804c 9e007c8 1ab24c1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
---
license: other
license_name: fair-ai-public-license-1.0-sd
license_link: https://freedevproject.org/faipl-1.0-sd/
language:
- en
pipeline_tag: text-to-image
tags:
- safetensors
- diffusers
- stable-diffusion
- stable-diffusion-xl
- art
library_name: diffusers
---
# NoobAI-XL-Merges
Various merges built on [Laxhar Lab's](https://huggingface.co/Laxhar) Illustrious-xl-based text to image model, uploaded for testing purposes.
These are provided as-is, and YMMV. The user is responsible for any outputs produced using these checkpoints.
Other models involved in these merges include:
- [comin/IterComp](https://huggingface.co/comin/IterComp)
- [CyberRealistic XL](https://civitai.com/models/312530/cyberrealistic-xl)
## Methods
Perpendicular merges are done via [sd-mecha](https://github.com/ljleb/sd-mecha) using the Python API, for example:
<details><summary>1) Merge noobaiXLNAIXL_vPred10Version-cyberrealistic4-perpendicular</summary>
```python
import sd_mecha
sd_mecha.set_log_level()
text_encoder_recipe = sd_mecha.model("noobaiXLNAIXL_vPred10Version.safetensors", "sdxl")
unet_recipe = sd_mecha.add_perpendicular(
sd_mecha.model("noobaiXLNAIXL_vPred10Version.safetensors", "sdxl"),
sd_mecha.model("cyberrealisticXL_v4.safetensors", "sdxl"),
sd_mecha.model("sd_xl_base_1.0_0.9vae.safetensors", "sdxl"),
)
recipe = sd_mecha.weighted_sum(
text_encoder_recipe,
unet_recipe,
alpha=(
sd_mecha.blocks("sdxl", "txt") |
sd_mecha.blocks("sdxl", "txt2") |
sd_mecha.default("sdxl", "unet", 1)
),
)
merger = sd_mecha.RecipeMerger(
models_dir=r"C:\path\to\models\directory",
)
merger.merge_and_save(recipe, output="output.safetensors")
```
</details><br>
<details><summary>2) Add v_pred and ztsnr keys to the resulting model for autodetection in Comfy/Forge</summary>
```python
from safetensors.torch import load_file, save_file
import torch
state_dict = load_file("output.safetensors")
state_dict["v_pred"] = torch.tensor([])
state_dict["ztsnr"] = torch.tensor([])
save_file(state_dict, "noobaiXLNAIXL_vPred10Version-cyberrealistic4-perpendicular.safetensors")
```
</details><br> |