Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
06248382
Commit
06248382
authored
Mar 21, 2024
by
comfyanonymous
Browse files
Add inverse noise scaling function.
parent
5d875d77
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
0 deletions
+4
-0
comfy/model_sampling.py
comfy/model_sampling.py
+3
-0
comfy/samplers.py
comfy/samplers.py
+1
-0
No files found.
comfy/model_sampling.py
View file @
06248382
...
@@ -20,6 +20,9 @@ class EPS:
...
@@ -20,6 +20,9 @@ class EPS:
noise
+=
latent_image
noise
+=
latent_image
return
noise
return
noise
def
inverse_noise_scaling
(
self
,
sigma
,
latent
):
return
latent
class
V_PREDICTION
(
EPS
):
class
V_PREDICTION
(
EPS
):
def
calculate_denoised
(
self
,
sigma
,
model_output
,
model_input
):
def
calculate_denoised
(
self
,
sigma
,
model_output
,
model_input
):
sigma
=
sigma
.
view
(
sigma
.
shape
[:
1
]
+
(
1
,)
*
(
model_output
.
ndim
-
1
))
sigma
=
sigma
.
view
(
sigma
.
shape
[:
1
]
+
(
1
,)
*
(
model_output
.
ndim
-
1
))
...
...
comfy/samplers.py
View file @
06248382
...
@@ -546,6 +546,7 @@ class KSAMPLER(Sampler):
...
@@ -546,6 +546,7 @@ class KSAMPLER(Sampler):
k_callback
=
lambda
x
:
callback
(
x
[
"i"
],
x
[
"denoised"
],
x
[
"x"
],
total_steps
)
k_callback
=
lambda
x
:
callback
(
x
[
"i"
],
x
[
"denoised"
],
x
[
"x"
],
total_steps
)
samples
=
self
.
sampler_function
(
model_k
,
noise
,
sigmas
,
extra_args
=
extra_args
,
callback
=
k_callback
,
disable
=
disable_pbar
,
**
self
.
extra_options
)
samples
=
self
.
sampler_function
(
model_k
,
noise
,
sigmas
,
extra_args
=
extra_args
,
callback
=
k_callback
,
disable
=
disable_pbar
,
**
self
.
extra_options
)
samples
=
model_wrap
.
inner_model
.
model_sampling
.
inverse_noise_scaling
(
sigmas
[
-
1
],
samples
)
return
samples
return
samples
...
...
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