diff options
author | LipeCarmel <44252177+LipeCarmel@users.noreply.github.com> | 2023-03-25 17:48:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-25 17:48:22 +0000 |
commit | 5c7ab90a4ea0ae907bb915c9ddbe40c529b7bcc9 (patch) | |
tree | cdb44923eac9583a7bb52d105c2ecadb45a76b9c /scripts | |
parent | 91ae48fd7e20c60d6374f340cac0939f56d87048 (diff) | |
download | stable-diffusion-webui-gfx803-5c7ab90a4ea0ae907bb915c9ddbe40c529b7bcc9.tar.gz stable-diffusion-webui-gfx803-5c7ab90a4ea0ae907bb915c9ddbe40c529b7bcc9.tar.bz2 stable-diffusion-webui-gfx803-5c7ab90a4ea0ae907bb915c9ddbe40c529b7bcc9.zip |
loopback.py Colab compatibility and bug fix
This code (suggested by @abvgdeabvgde2 ) literally does the same thing and it does not break with Python 3.9, making it helpful for Google Colab users (me included).
fixes #8927
Also a partial fix for #8902 but it does not resolve the unresponsive UI problem faced by @Archon332
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/loopback.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/scripts/loopback.py b/scripts/loopback.py index 9c388aa8..d3065fe6 100644 --- a/scripts/loopback.py +++ b/scripts/loopback.py @@ -54,15 +54,12 @@ class Script(scripts.Script): return strength
progress = loop / (loops - 1)
- match denoising_curve:
- case "Aggressive":
- strength = math.sin((progress) * math.pi * 0.5)
-
- case "Lazy":
- strength = 1 - math.cos((progress) * math.pi * 0.5)
-
- case _:
- strength = progress
+ if denoising_curve == "Aggressive":
+ strength = math.sin((progress) * math.pi * 0.5)
+ elif denoising_curve == "Lazy":
+ strength = 1 - math.cos((progress) * math.pi * 0.5)
+ else:
+ strength = progress
change = (final_denoising_strength - initial_denoising_strength) * strength
return initial_denoising_strength + change
|