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
f2fe635c
"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "0d79de7322f21063e615d555704e14f600c6eb40"
Commit
f2fe635c
authored
Mar 15, 2024
by
comfyanonymous
Browse files
SamplerDPMAdaptative node to test the different options.
parent
448d9263
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
comfy/samplers.py
comfy/samplers.py
+2
-2
comfy_extras/nodes_custom_sampler.py
comfy_extras/nodes_custom_sampler.py
+28
-0
No files found.
comfy/samplers.py
View file @
f2fe635c
...
@@ -559,11 +559,11 @@ def ksampler(sampler_name, extra_options={}, inpaint_options={}):
...
@@ -559,11 +559,11 @@ def ksampler(sampler_name, extra_options={}, inpaint_options={}):
return
k_diffusion_sampling
.
sample_dpm_fast
(
model
,
noise
,
sigma_min
,
sigmas
[
0
],
total_steps
,
extra_args
=
extra_args
,
callback
=
callback
,
disable
=
disable
)
return
k_diffusion_sampling
.
sample_dpm_fast
(
model
,
noise
,
sigma_min
,
sigmas
[
0
],
total_steps
,
extra_args
=
extra_args
,
callback
=
callback
,
disable
=
disable
)
sampler_function
=
dpm_fast_function
sampler_function
=
dpm_fast_function
elif
sampler_name
==
"dpm_adaptive"
:
elif
sampler_name
==
"dpm_adaptive"
:
def
dpm_adaptive_function
(
model
,
noise
,
sigmas
,
extra_args
,
callback
,
disable
):
def
dpm_adaptive_function
(
model
,
noise
,
sigmas
,
extra_args
,
callback
,
disable
,
**
extra_options
):
sigma_min
=
sigmas
[
-
1
]
sigma_min
=
sigmas
[
-
1
]
if
sigma_min
==
0
:
if
sigma_min
==
0
:
sigma_min
=
sigmas
[
-
2
]
sigma_min
=
sigmas
[
-
2
]
return
k_diffusion_sampling
.
sample_dpm_adaptive
(
model
,
noise
,
sigma_min
,
sigmas
[
0
],
extra_args
=
extra_args
,
callback
=
callback
,
disable
=
disable
)
return
k_diffusion_sampling
.
sample_dpm_adaptive
(
model
,
noise
,
sigma_min
,
sigmas
[
0
],
extra_args
=
extra_args
,
callback
=
callback
,
disable
=
disable
,
**
extra_options
)
sampler_function
=
dpm_adaptive_function
sampler_function
=
dpm_adaptive_function
else
:
else
:
sampler_function
=
getattr
(
k_diffusion_sampling
,
"sample_{}"
.
format
(
sampler_name
))
sampler_function
=
getattr
(
k_diffusion_sampling
,
"sample_{}"
.
format
(
sampler_name
))
...
...
comfy_extras/nodes_custom_sampler.py
View file @
f2fe635c
...
@@ -283,6 +283,33 @@ class SamplerLMS:
...
@@ -283,6 +283,33 @@ class SamplerLMS:
sampler
=
comfy
.
samplers
.
ksampler
(
"lms"
,
{
"order"
:
order
})
sampler
=
comfy
.
samplers
.
ksampler
(
"lms"
,
{
"order"
:
order
})
return
(
sampler
,
)
return
(
sampler
,
)
class
SamplerDPMAdaptative
:
@
classmethod
def
INPUT_TYPES
(
s
):
return
{
"required"
:
{
"order"
:
(
"INT"
,
{
"default"
:
3
,
"min"
:
2
,
"max"
:
3
}),
"rtol"
:
(
"FLOAT"
,
{
"default"
:
0.05
,
"min"
:
0.0
,
"max"
:
100.0
,
"step"
:
0.01
,
"round"
:
False
}),
"atol"
:
(
"FLOAT"
,
{
"default"
:
0.0078
,
"min"
:
0.0
,
"max"
:
100.0
,
"step"
:
0.01
,
"round"
:
False
}),
"h_init"
:
(
"FLOAT"
,
{
"default"
:
0.05
,
"min"
:
0.0
,
"max"
:
100.0
,
"step"
:
0.01
,
"round"
:
False
}),
"pcoeff"
:
(
"FLOAT"
,
{
"default"
:
0.0
,
"min"
:
0.0
,
"max"
:
100.0
,
"step"
:
0.01
,
"round"
:
False
}),
"icoeff"
:
(
"FLOAT"
,
{
"default"
:
1.0
,
"min"
:
0.0
,
"max"
:
100.0
,
"step"
:
0.01
,
"round"
:
False
}),
"dcoeff"
:
(
"FLOAT"
,
{
"default"
:
0.0
,
"min"
:
0.0
,
"max"
:
100.0
,
"step"
:
0.01
,
"round"
:
False
}),
"accept_safety"
:
(
"FLOAT"
,
{
"default"
:
0.81
,
"min"
:
0.0
,
"max"
:
100.0
,
"step"
:
0.01
,
"round"
:
False
}),
"eta"
:
(
"FLOAT"
,
{
"default"
:
0.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
}),
}
}
RETURN_TYPES
=
(
"SAMPLER"
,)
CATEGORY
=
"sampling/custom_sampling/samplers"
FUNCTION
=
"get_sampler"
def
get_sampler
(
self
,
order
,
rtol
,
atol
,
h_init
,
pcoeff
,
icoeff
,
dcoeff
,
accept_safety
,
eta
,
s_noise
):
sampler
=
comfy
.
samplers
.
ksampler
(
"dpm_adaptive"
,
{
"order"
:
order
,
"rtol"
:
rtol
,
"atol"
:
atol
,
"h_init"
:
h_init
,
"pcoeff"
:
pcoeff
,
"icoeff"
:
icoeff
,
"dcoeff"
:
dcoeff
,
"accept_safety"
:
accept_safety
,
"eta"
:
eta
,
"s_noise"
:
s_noise
})
return
(
sampler
,
)
class
SamplerCustom
:
class
SamplerCustom
:
@
classmethod
@
classmethod
def
INPUT_TYPES
(
s
):
def
INPUT_TYPES
(
s
):
...
@@ -348,6 +375,7 @@ NODE_CLASS_MAPPINGS = {
...
@@ -348,6 +375,7 @@ NODE_CLASS_MAPPINGS = {
"SamplerDPMPP_3M_SDE"
:
SamplerDPMPP_3M_SDE
,
"SamplerDPMPP_3M_SDE"
:
SamplerDPMPP_3M_SDE
,
"SamplerDPMPP_2M_SDE"
:
SamplerDPMPP_2M_SDE
,
"SamplerDPMPP_2M_SDE"
:
SamplerDPMPP_2M_SDE
,
"SamplerDPMPP_SDE"
:
SamplerDPMPP_SDE
,
"SamplerDPMPP_SDE"
:
SamplerDPMPP_SDE
,
"SamplerDPMAdaptative"
:
SamplerDPMAdaptative
,
"SplitSigmas"
:
SplitSigmas
,
"SplitSigmas"
:
SplitSigmas
,
"FlipSigmas"
:
FlipSigmas
,
"FlipSigmas"
:
FlipSigmas
,
}
}
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