Merge pull request #4120 from aliencaocao/enable-override-hypernet

Enable override_settings to take effect for hypernetworks
This commit is contained in:
AUTOMATIC1111 2022-11-20 16:49:06 +03:00 committed by GitHub
commit 828438b4a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -424,13 +424,15 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
try: try:
for k, v in p.override_settings.items(): for k, v in p.override_settings.items():
setattr(opts, k, v) # we don't call onchange for simplicity which makes changing model, hypernet impossible setattr(opts, k, v) # we don't call onchange for simplicity which makes changing model impossible
if k == 'sd_hypernetwork': shared.reload_hypernetworks() # make onchange call for changing hypernet since it is relatively fast to load on-change, while SD models are not
res = process_images_inner(p) res = process_images_inner(p)
finally: finally: # restore opts to original state
for k, v in stored_opts.items(): for k, v in stored_opts.items():
setattr(opts, k, v) setattr(opts, k, v)
if k == 'sd_hypernetwork': shared.reload_hypernetworks()
return res return res