Commit a1743e45 authored by AUTOMATIC's avatar AUTOMATIC

remove double basicr requirement

add seed change for anon
parent a8504157
...@@ -99,6 +99,10 @@ def create_random_tensors(shape, seeds): ...@@ -99,6 +99,10 @@ def create_random_tensors(shape, seeds):
return x return x
def set_seed(seed):
return int(random.randrange(4294967294)) if seed is None or seed == -1 else seed
def process_images(p: StableDiffusionProcessing) -> Processed: def process_images(p: StableDiffusionProcessing) -> Processed:
"""this is the main loop that both txt2img and img2img use; it calls func_init once inside all the scopes and func_sample once per batch""" """this is the main loop that both txt2img and img2img use; it calls func_init once inside all the scopes and func_sample once per batch"""
...@@ -107,7 +111,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed: ...@@ -107,7 +111,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
assert p.prompt is not None assert p.prompt is not None
torch_gc() torch_gc()
seed = int(random.randrange(4294967294)) if p.seed == -1 else p.seed seed = set_seed(p.seed)
os.makedirs(p.outpath_samples, exist_ok=True) os.makedirs(p.outpath_samples, exist_ok=True)
os.makedirs(p.outpath_grids, exist_ok=True) os.makedirs(p.outpath_grids, exist_ok=True)
......
...@@ -8,7 +8,6 @@ torch ...@@ -8,7 +8,6 @@ torch
transformers transformers
omegaconf omegaconf
pytorch_lightning pytorch_lightning
basicsr
diffusers diffusers
invisible-watermark invisible-watermark
git+https://github.com/crowsonkb/k-diffusion.git git+https://github.com/crowsonkb/k-diffusion.git
......
basicsr==1.4.1 basicsr==1.3.5
gfpgan gfpgan
gradio==3.2 gradio==3.2
numpy==1.22.0 numpy==1.22.0
...@@ -8,4 +8,3 @@ torch ...@@ -8,4 +8,3 @@ torch
transformers==4.19.2 transformers==4.19.2
omegaconf==2.1.1 omegaconf==2.1.1
pytorch_lightning==1.7.2 pytorch_lightning==1.7.2
basicsr==1.3.5
...@@ -50,7 +50,7 @@ class Script(scripts.Script): ...@@ -50,7 +50,7 @@ class Script(scripts.Script):
return [put_at_start] return [put_at_start]
def run(self, p, put_at_start): def run(self, p, put_at_start):
seed = int(random.randrange(4294967294) if p.seed == -1 else p.seed) seed = modules.processing.set_seed(p.seed)
original_prompt = p.prompt[0] if type(p.prompt) == list else p.prompt original_prompt = p.prompt[0] if type(p.prompt) == list else p.prompt
......
...@@ -108,7 +108,7 @@ class Script(scripts.Script): ...@@ -108,7 +108,7 @@ class Script(scripts.Script):
return [x_type, x_values, y_type, y_values] return [x_type, x_values, y_type, y_values]
def run(self, p, x_type, x_values, y_type, y_values): def run(self, p, x_type, x_values, y_type, y_values):
p.seed = int(random.randrange(4294967294) if p.seed == -1 else p.seed) p.seed = modules.processing.set_seed(p.seed)
p.batch_size = 1 p.batch_size = 1
p.batch_count = 1 p.batch_count = 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment