diff options
author | xucj98 <975114697@qq.com> | 2022-11-25 09:07:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-25 09:07:00 +0000 |
commit | 263b323de12eb2444b0818105575a2bc69ab0344 (patch) | |
tree | 7bc4a7802bdaba21550ad281cc08c3fc1037b074 /modules/sd_samplers.py | |
parent | d20dbe47e06de7f6c0e65242a04c9bb1410ef7cb (diff) | |
parent | 828438b4a190759807f9054932cae3a8b880ddf1 (diff) | |
download | stable-diffusion-webui-gfx803-263b323de12eb2444b0818105575a2bc69ab0344.tar.gz stable-diffusion-webui-gfx803-263b323de12eb2444b0818105575a2bc69ab0344.tar.bz2 stable-diffusion-webui-gfx803-263b323de12eb2444b0818105575a2bc69ab0344.zip |
Merge branch 'AUTOMATIC1111:master' into draft
Diffstat (limited to 'modules/sd_samplers.py')
-rw-r--r-- | modules/sd_samplers.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/modules/sd_samplers.py b/modules/sd_samplers.py index 783992d2..4fe67854 100644 --- a/modules/sd_samplers.py +++ b/modules/sd_samplers.py @@ -46,16 +46,23 @@ all_samplers = [ SamplerData('DDIM', lambda model: VanillaStableDiffusionSampler(ldm.models.diffusion.ddim.DDIMSampler, model), [], {}),
SamplerData('PLMS', lambda model: VanillaStableDiffusionSampler(ldm.models.diffusion.plms.PLMSSampler, model), [], {}),
]
+all_samplers_map = {x.name: x for x in all_samplers}
samplers = []
samplers_for_img2img = []
-def create_sampler_with_index(list_of_configs, index, model):
- config = list_of_configs[index]
+def create_sampler(name, model):
+ if name is not None:
+ config = all_samplers_map.get(name, None)
+ else:
+ config = all_samplers[0]
+
+ assert config is not None, f'bad sampler name: {name}'
+
sampler = config.constructor(model)
sampler.config = config
-
+
return sampler
|