diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-09-11 20:24:24 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-09-11 20:24:24 +0000 |
commit | 8fb9c57ed62dcef721d50c1eeb9c20f65c509215 (patch) | |
tree | e30c32744eba482bf82e488f41d874ddf768eac0 /modules/processing.py | |
parent | d97c6f221ff9f97823c7ffce181a243dec895fa1 (diff) | |
download | stable-diffusion-webui-gfx803-8fb9c57ed62dcef721d50c1eeb9c20f65c509215.tar.gz stable-diffusion-webui-gfx803-8fb9c57ed62dcef721d50c1eeb9c20f65c509215.tar.bz2 stable-diffusion-webui-gfx803-8fb9c57ed62dcef721d50c1eeb9c20f65c509215.zip |
add half() supporrt for CLIP interrogation
Diffstat (limited to 'modules/processing.py')
-rw-r--r-- | modules/processing.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/modules/processing.py b/modules/processing.py index cf2e13d3..b1e8dad2 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -10,6 +10,7 @@ from PIL import Image, ImageFilter, ImageOps import random
import modules.sd_hijack
+from modules import devices
from modules.sd_hijack import model_hijack
from modules.sd_samplers import samplers, samplers_for_img2img
from modules.shared import opts, cmd_opts, state
@@ -23,11 +24,6 @@ opt_C = 4 opt_f = 8
-def torch_gc():
- if torch.cuda.is_available():
- torch.cuda.empty_cache()
- torch.cuda.ipc_collect()
-
class StableDiffusionProcessing:
def __init__(self, sd_model=None, outpath_samples=None, outpath_grids=None, prompt="", prompt_style="None", seed=-1, subseed=-1, subseed_strength=0, seed_resize_from_h=-1, seed_resize_from_w=-1, sampler_index=0, batch_size=1, n_iter=1, steps=50, cfg_scale=7.0, width=512, height=512, restore_faces=False, tiling=False, do_not_save_samples=False, do_not_save_grid=False, extra_generation_params=None, overlay_images=None, negative_prompt=None):
@@ -157,7 +153,7 @@ 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"""
assert p.prompt is not None
- torch_gc()
+ devices.torch_gc()
fix_seed(p)
@@ -258,7 +254,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed: x_sample = x_sample.astype(np.uint8)
if p.restore_faces:
- torch_gc()
+ devices.torch_gc()
x_sample = modules.face_restoration.restore_faces(x_sample)
@@ -297,7 +293,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed: if opts.grid_save:
images.save_image(grid, p.outpath_grids, "grid", all_seeds[0], all_prompts[0], opts.grid_format, info=infotext(), short_filename=not opts.grid_extended_filename)
- torch_gc()
+ devices.torch_gc()
return Processed(p, output_images, all_seeds[0], infotext())
|