Skip to content

Commit

Permalink
Merge branch 'ljleb-fix-clip'
Browse files Browse the repository at this point in the history
  • Loading branch information
s1dlx committed Jul 24, 2023
2 parents f942d51 + 36256f4 commit f9c39b6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ You can have a look at the provided `merge_models.py` cli for an example on how

## Changelog

### 0.9.1
### 0.9.1, 0.9.2
- bugfixes
- support for pix2pix and inpainting models

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sd-meh"
version = "0.9.1"
version = "0.9.2"
description = "stable diffusion merging execution helper"
authors = ["s1dlx <[email protected]>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion sd_meh/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.9.1"
__version__ = "0.9.2"
12 changes: 7 additions & 5 deletions sd_meh/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,12 @@ def merge_models(
bases,
merge_mode,
precision=precision,
weights_clip=False,
weights_clip=weights_clip,
iterations=iterations,
device=device,
work_device=work_device,
threads=threads,
)
# clip only after the last re-basin iteration
if weights_clip:
merged = clip_weights(thetas, merged)
else:
merged = simple_merge(
thetas,
Expand Down Expand Up @@ -298,7 +295,7 @@ def rebasin_merge(
new_bases,
merge_mode,
precision,
weights_clip,
False,
device,
work_device,
threads,
Expand Down Expand Up @@ -344,6 +341,11 @@ def rebasin_merge(

log_vram("model a updated")

if weights_clip:
clip_thetas = thetas.copy()
clip_thetas["model_a"] = model_a
thetas["model_a"] = clip_weights(thetas, thetas["model_a"])

return thetas["model_a"]


Expand Down

0 comments on commit f9c39b6

Please sign in to comment.