diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-11-19 09:01:51 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-11-19 09:01:51 +0000 |
commit | cdc8020d13c5eef099c609b0a911ccf3568afc0d (patch) | |
tree | 725e30c93846fe4ec6c713c8922b5a7a15b5e3a5 /modules/sd_samplers.py | |
parent | d9fd4525a5d684100997130cc4132736bab1e4d9 (diff) | |
download | stable-diffusion-webui-gfx803-cdc8020d13c5eef099c609b0a911ccf3568afc0d.tar.gz stable-diffusion-webui-gfx803-cdc8020d13c5eef099c609b0a911ccf3568afc0d.tar.bz2 stable-diffusion-webui-gfx803-cdc8020d13c5eef099c609b0a911ccf3568afc0d.zip |
change StableDiffusionProcessing to internally use sampler name instead of sampler index
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
|