Skip to content

Commit

Permalink
Merge pull request AUTOMATIC1111#13302 from Zolxys/patch-1
Browse files Browse the repository at this point in the history
Fix: --sd_model in "Prompts from file or textbox" script is not working
  • Loading branch information
AUTOMATIC1111 authored Sep 30, 2023
2 parents 9b17416 + 701feab commit 34055f9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions scripts/prompts_from_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
import modules.scripts as scripts
import gradio as gr

from modules import sd_samplers, errors
from modules import sd_samplers, errors, sd_models
from modules.processing import Processed, process_images
from modules.shared import state


def process_model_tag(tag):
info = sd_models.get_closet_checkpoint_match(tag)
assert info is not None, f'Unknown checkpoint: {tag}'
return info.name


def process_string_tag(tag):
return tag

Expand All @@ -27,7 +33,7 @@ def process_boolean_tag(tag):


prompt_tags = {
"sd_model": None,
"sd_model": process_model_tag,
"outpath_samples": process_string_tag,
"outpath_grids": process_string_tag,
"prompt_for_display": process_string_tag,
Expand Down Expand Up @@ -156,7 +162,10 @@ def run(self, p, checkbox_iterate, checkbox_iterate_batch, prompt_txt: str):

copy_p = copy.copy(p)
for k, v in args.items():
setattr(copy_p, k, v)
if k == "sd_model":
copy_p.override_settings['sd_model_checkpoint'] = v
else:
setattr(copy_p, k, v)

proc = process_images(copy_p)
images += proc.images
Expand Down

0 comments on commit 34055f9

Please sign in to comment.