MCPcopy Index your code
hub / github.com/Extraltodeus/DistanceSampler / add_samplers

Function add_samplers

__init__.py:4–19  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2from .presets_to_add import extra_samplers
3
4def add_samplers():
5 from comfy.samplers import KSampler, k_diffusion_sampling
6 added = 0
7 samplers_names = [n for n in extra_samplers][::-1]
8 for sampler in samplers_names:
9 if sampler not in KSampler.SAMPLERS:
10 try:
11 idx = KSampler.SAMPLERS.index("uni_pc_bh2") # Last item in the samplers list
12 KSampler.SAMPLERS.insert(idx+1, sampler) # Add our custom samplers
13 setattr(k_diffusion_sampling, "sample_{}".format(sampler), extra_samplers[sampler])
14 added += 1
15 except ValueError as _err:
16 pass
17 if added > 0:
18 import importlib
19 importlib.reload(k_diffusion_sampling)
20
21add_samplers()
22

Callers 1

__init__.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected