Skip to content

Commit

Permalink
remove double basicr requirement
Browse files Browse the repository at this point in the history
add seed change for anon
  • Loading branch information
AUTOMATIC1111 committed Sep 6, 2022
1 parent a850415 commit a1743e4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
6 changes: 5 additions & 1 deletion modules/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ def create_random_tensors(shape, seeds):
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:
"""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"""

Expand All @@ -107,7 +111,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
assert p.prompt is not None
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_grids, exist_ok=True)
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ torch
transformers
omegaconf
pytorch_lightning
basicsr
diffusers
invisible-watermark
git+https://github.com/crowsonkb/k-diffusion.git
Expand Down
3 changes: 1 addition & 2 deletions requirements_versions.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
basicsr==1.4.1
basicsr==1.3.5
gfpgan
gradio==3.2
numpy==1.22.0
Expand All @@ -8,4 +8,3 @@ torch
transformers==4.19.2
omegaconf==2.1.1
pytorch_lightning==1.7.2
basicsr==1.3.5
2 changes: 1 addition & 1 deletion scripts/prompt_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def ui(self, is_img2img):
return [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

Expand Down
2 changes: 1 addition & 1 deletion scripts/xy_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def ui(self, is_img2img):
return [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_count = 1

Expand Down

0 comments on commit a1743e4

Please sign in to comment.