diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-09-07 01:44:44 +0300 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-09-07 01:44:44 +0300 |
commit | a1743e4518e5770296f097d7d1d29094c2b6bae4 (patch) | |
tree | d697c2065def31cb3ed7fb30287504658278ccf4 | |
parent | a8504157a02e61d787a2b924f4f8de6f578f0aac (diff) |
remove double basicr requirement
add seed change for anon
-rw-r--r-- | modules/processing.py | 6 | ||||
-rw-r--r-- | requirements.txt | 1 | ||||
-rw-r--r-- | requirements_versions.txt | 3 | ||||
-rw-r--r-- | scripts/prompt_matrix.py | 2 | ||||
-rw-r--r-- | scripts/xy_grid.py | 2 |
5 files changed, 8 insertions, 6 deletions
diff --git a/modules/processing.py b/modules/processing.py index 23fe54d1..78bc73b9 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -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"""
@@ -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)
diff --git a/requirements.txt b/requirements.txt index cb27daf5..c9e3f2fc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,6 @@ torch transformers
omegaconf
pytorch_lightning
-basicsr
diffusers
invisible-watermark
git+https://github.com/crowsonkb/k-diffusion.git
diff --git a/requirements_versions.txt b/requirements_versions.txt index 754b163c..177c6b58 100644 --- a/requirements_versions.txt +++ b/requirements_versions.txt @@ -1,4 +1,4 @@ -basicsr==1.4.1
+basicsr==1.3.5
gfpgan
gradio==3.2
numpy==1.22.0
@@ -8,4 +8,3 @@ torch transformers==4.19.2
omegaconf==2.1.1
pytorch_lightning==1.7.2
-basicsr==1.3.5
diff --git a/scripts/prompt_matrix.py b/scripts/prompt_matrix.py index 6d27df5a..a61d1183 100644 --- a/scripts/prompt_matrix.py +++ b/scripts/prompt_matrix.py @@ -50,7 +50,7 @@ class Script(scripts.Script): 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
diff --git a/scripts/xy_grid.py b/scripts/xy_grid.py index 11be7a1b..df549298 100644 --- a/scripts/xy_grid.py +++ b/scripts/xy_grid.py @@ -108,7 +108,7 @@ class Script(scripts.Script): 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
|