Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions sgm/inference/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,18 +263,12 @@ def get_guider_config(params: SamplingParams):
elif params.guider == Guider.VANILLA:
scale = params.scale

thresholder = params.thresholder

if thresholder == Thresholder.NONE:
dyn_thresh_config = {
"target": "sgm.modules.diffusionmodules.sampling_utils.NoDynamicThresholding"
}
else:
if params.thresholder != Thresholder.NONE:
raise NotImplementedError

guider_config = {
"target": "sgm.modules.diffusionmodules.guiders.VanillaCFG",
"params": {"scale": scale, "dyn_thresh_config": dyn_thresh_config},
"params": {"scale": scale},
}
else:
raise NotImplementedError
Expand Down
10 changes: 10 additions & 0 deletions tests/inference/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
import sgm.inference.helpers as helpers


def test_default_sampling_params_build_a_vanilla_cfg_sampler():
from sgm.inference.api import get_sampler_config
from sgm.modules.diffusionmodules.guiders import VanillaCFG

sampler = get_sampler_config(SamplingParams())

assert isinstance(sampler.guider, VanillaCFG)
assert sampler.guider.scale == 6.0


@pytest.mark.inference
class TestInference:
@fixture(scope="class", params=model_specs.keys())
Expand Down