-
-
Save upbit/67b9753a62cd53e40e45942d08b91540 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import os | |
import sys | |
import traceback | |
import modules.scripts as scripts | |
import gradio as gr | |
from modules.processing import Processed, process_images, fix_seed | |
class Script(scripts.Script): | |
def title(self): | |
return "Run N times - Seed(+1)" | |
def ui(self, is_img2img): | |
n = gr.Textbox(label="n", value="3") | |
no_save_grid = gr.Checkbox(label="Do not save grid", value=True) | |
return [n, no_save_grid] | |
def run(self, p, n, no_save_grid): | |
fix_seed(p) | |
loop = int(n) | |
print(f"Prompt matrix will create {loop} images using a total of {p.n_iter} batches.") | |
original_prompt = p.prompt[0] if type(p.prompt) == list else p.prompt | |
p.prompt = [original_prompt] * loop | |
p.prompt_for_display = original_prompt | |
p.n_iter = math.ceil(loop / p.batch_size) | |
p.do_not_save_grid = no_save_grid | |
return process_images(p) |
Great modification of the original, thank you.
This script is not very effective. In fact, the batch count
is just the Seed+1
I just needed it because I got out of memory exceptions when I tried to generate bigger images with a batch count of more than 1.
This script fixes that, so I'm happy. Maybe I'm just too much of a noob to see the reason why seed+1 is an issue though.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great modification of the original, thank you.