Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
7a13a3f4
Commit
7a13a3f4
authored
May 17, 2023
by
Sakura-Luna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TAESD fix
parent
85232a5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
modules/sd_samplers_common.py
modules/sd_samplers_common.py
+5
-4
modules/sd_vae_taesd.py
modules/sd_vae_taesd.py
+1
-1
No files found.
modules/sd_samplers_common.py
View file @
7a13a3f4
...
@@ -35,13 +35,14 @@ def single_sample_to_image(sample, approximation=None):
...
@@ -35,13 +35,14 @@ def single_sample_to_image(sample, approximation=None):
elif
approximation
==
1
:
elif
approximation
==
1
:
x_sample
=
sd_vae_approx
.
model
()(
sample
.
to
(
devices
.
device
,
devices
.
dtype
)
.
unsqueeze
(
0
))[
0
]
.
detach
()
x_sample
=
sd_vae_approx
.
model
()(
sample
.
to
(
devices
.
device
,
devices
.
dtype
)
.
unsqueeze
(
0
))[
0
]
.
detach
()
elif
approximation
==
3
:
elif
approximation
==
3
:
x_sample
=
sd_vae_taesd
.
model
()(
sample
.
to
(
devices
.
device
,
devices
.
dtype
)
.
unsqueeze
(
0
))[
0
]
.
detach
()
x_sample
=
sample
*
1.5
x_sample
=
sd_vae_taesd
.
TAESD
.
unscale_latents
(
x_sample
)
# returns value in [-2, 2]
x_sample
=
sd_vae_taesd
.
model
()(
x_sample
.
to
(
devices
.
device
,
devices
.
dtype
)
.
unsqueeze
(
0
))[
0
]
.
detach
()
x_sample
=
x_sample
*
0.5
else
:
else
:
x_sample
=
processing
.
decode_first_stage
(
shared
.
sd_model
,
sample
.
unsqueeze
(
0
))[
0
]
x_sample
=
processing
.
decode_first_stage
(
shared
.
sd_model
,
sample
.
unsqueeze
(
0
))[
0
]
x_sample
=
torch
.
clamp
((
x_sample
+
1.0
)
/
2.0
,
min
=
0.0
,
max
=
1.0
)
if
approximation
!=
3
:
x_sample
=
(
x_sample
+
1.0
)
/
2.0
x_sample
=
torch
.
clamp
(
x_sample
,
min
=
0.0
,
max
=
1.0
)
x_sample
=
255.
*
np
.
moveaxis
(
x_sample
.
cpu
()
.
numpy
(),
0
,
2
)
x_sample
=
255.
*
np
.
moveaxis
(
x_sample
.
cpu
()
.
numpy
(),
0
,
2
)
x_sample
=
x_sample
.
astype
(
np
.
uint8
)
x_sample
=
x_sample
.
astype
(
np
.
uint8
)
...
...
modules/sd_vae_taesd.py
View file @
7a13a3f4
...
@@ -45,7 +45,7 @@ def decoder():
...
@@ -45,7 +45,7 @@ def decoder():
class
TAESD
(
nn
.
Module
):
class
TAESD
(
nn
.
Module
):
latent_magnitude
=
2
latent_magnitude
=
3
latent_shift
=
0.5
latent_shift
=
0.5
def
__init__
(
self
,
decoder_path
=
"taesd_decoder.pth"
):
def
__init__
(
self
,
decoder_path
=
"taesd_decoder.pth"
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment