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
66756de1
Commit
66756de1
authored
Sep 28, 2023
by
comfyanonymous
Browse files
Add SamplerDPMPP_2M_SDE node.
parent
26b73728
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
comfy/samplers.py
comfy/samplers.py
+2
-2
comfy_extras/nodes_custom_sampler.py
comfy_extras/nodes_custom_sampler.py
+25
-0
No files found.
comfy/samplers.py
View file @
66756de1
...
...
@@ -598,7 +598,7 @@ KSAMPLER_NAMES = ["euler", "euler_ancestral", "heun", "dpm_2", "dpm_2_ancestral"
"lms"
,
"dpm_fast"
,
"dpm_adaptive"
,
"dpmpp_2s_ancestral"
,
"dpmpp_sde"
,
"dpmpp_sde_gpu"
,
"dpmpp_2m"
,
"dpmpp_2m_sde"
,
"dpmpp_2m_sde_gpu"
,
"dpmpp_3m_sde"
,
"dpmpp_3m_sde_gpu"
,
"ddpm"
]
def
ksampler
(
sampler_name
):
def
ksampler
(
sampler_name
,
extra_options
=
{}
):
class
KSAMPLER
(
Sampler
):
def
sample
(
self
,
model_wrap
,
sigmas
,
extra_args
,
callback
,
noise
,
latent_image
=
None
,
denoise_mask
=
None
,
disable_pbar
=
False
):
extra_args
[
"denoise_mask"
]
=
denoise_mask
...
...
@@ -627,7 +627,7 @@ def ksampler(sampler_name):
elif
sampler_name
==
"dpm_adaptive"
:
samples
=
k_diffusion_sampling
.
sample_dpm_adaptive
(
model_k
,
noise
,
sigma_min
,
sigmas
[
0
],
extra_args
=
extra_args
,
callback
=
k_callback
,
disable
=
disable_pbar
)
else
:
samples
=
getattr
(
k_diffusion_sampling
,
"sample_{}"
.
format
(
sampler_name
))(
model_k
,
noise
,
sigmas
,
extra_args
=
extra_args
,
callback
=
k_callback
,
disable
=
disable_pbar
)
samples
=
getattr
(
k_diffusion_sampling
,
"sample_{}"
.
format
(
sampler_name
))(
model_k
,
noise
,
sigmas
,
extra_args
=
extra_args
,
callback
=
k_callback
,
disable
=
disable_pbar
,
**
extra_options
)
return
samples
return
KSAMPLER
...
...
comfy_extras/nodes_custom_sampler.py
View file @
66756de1
...
...
@@ -77,6 +77,30 @@ class KSamplerSelect:
sampler
=
comfy
.
samplers
.
sampler_class
(
sampler_name
)()
return
(
sampler
,
)
class
SamplerDPMPP_2M_SDE
:
@
classmethod
def
INPUT_TYPES
(
s
):
return
{
"required"
:
{
"solver_type"
:
([
'midpoint'
,
'heun'
],
),
"eta"
:
(
"FLOAT"
,
{
"default"
:
1.0
,
"min"
:
0.0
,
"max"
:
100.0
,
"step"
:
0.01
,
"round"
:
False
}),
"s_noise"
:
(
"FLOAT"
,
{
"default"
:
1.0
,
"min"
:
0.0
,
"max"
:
100.0
,
"step"
:
0.01
,
"round"
:
False
}),
"noise_device"
:
([
'gpu'
,
'cpu'
],
),
}
}
RETURN_TYPES
=
(
"SAMPLER"
,)
CATEGORY
=
"_for_testing/custom_sampling"
FUNCTION
=
"get_sampler"
def
get_sampler
(
self
,
solver_type
,
eta
,
s_noise
,
noise_device
):
if
noise_device
==
'cpu'
:
sampler_name
=
"dpmpp_2m_sde"
else
:
sampler_name
=
"dpmpp_2m_sde_gpu"
sampler
=
comfy
.
samplers
.
ksampler
(
sampler_name
,
{
"eta"
:
eta
,
"s_noise"
:
s_noise
,
"solver_type"
:
solver_type
})()
return
(
sampler
,
)
class
SamplerCustom
:
@
classmethod
def
INPUT_TYPES
(
s
):
...
...
@@ -132,6 +156,7 @@ NODE_CLASS_MAPPINGS = {
"SamplerCustom"
:
SamplerCustom
,
"KarrasScheduler"
:
KarrasScheduler
,
"KSamplerSelect"
:
KSamplerSelect
,
"SamplerDPMPP_2M_SDE"
:
SamplerDPMPP_2M_SDE
,
"BasicScheduler"
:
BasicScheduler
,
"SplitSigmas"
:
SplitSigmas
,
}
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