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
907010e0
Commit
907010e0
authored
Apr 20, 2023
by
comfyanonymous
Browse files
Remove some useless code.
parent
31e60adb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
17 deletions
+0
-17
comfy/samplers.py
comfy/samplers.py
+0
-17
No files found.
comfy/samplers.py
View file @
907010e0
...
@@ -7,23 +7,6 @@ from comfy import model_management
...
@@ -7,23 +7,6 @@ from comfy import model_management
from
.ldm.models.diffusion.ddim
import
DDIMSampler
from
.ldm.models.diffusion.ddim
import
DDIMSampler
from
.ldm.modules.diffusionmodules.util
import
make_ddim_timesteps
from
.ldm.modules.diffusionmodules.util
import
make_ddim_timesteps
class
CFGDenoiser
(
torch
.
nn
.
Module
):
def
__init__
(
self
,
model
):
super
().
__init__
()
self
.
inner_model
=
model
def
forward
(
self
,
x
,
sigma
,
uncond
,
cond
,
cond_scale
):
if
len
(
uncond
[
0
])
==
len
(
cond
[
0
])
and
x
.
shape
[
0
]
*
x
.
shape
[
2
]
*
x
.
shape
[
3
]
<
(
96
*
96
):
#TODO check memory instead
x_in
=
torch
.
cat
([
x
]
*
2
)
sigma_in
=
torch
.
cat
([
sigma
]
*
2
)
cond_in
=
torch
.
cat
([
uncond
,
cond
])
uncond
,
cond
=
self
.
inner_model
(
x_in
,
sigma_in
,
cond
=
cond_in
).
chunk
(
2
)
else
:
cond
=
self
.
inner_model
(
x
,
sigma
,
cond
=
cond
)
uncond
=
self
.
inner_model
(
x
,
sigma
,
cond
=
uncond
)
return
uncond
+
(
cond
-
uncond
)
*
cond_scale
#The main sampling function shared by all the samplers
#The main sampling function shared by all the samplers
#Returns predicted noise
#Returns predicted noise
def
sampling_function
(
model_function
,
x
,
timestep
,
uncond
,
cond
,
cond_scale
,
cond_concat
=
None
,
model_options
=
{}):
def
sampling_function
(
model_function
,
x
,
timestep
,
uncond
,
cond
,
cond_scale
,
cond_concat
=
None
,
model_options
=
{}):
...
...
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