diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-07-10 17:41:09 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-10 17:41:09 +0000 |
commit | 910d4f61e5a08c620dd5010665815e2694a55d11 (patch) | |
tree | ad0a26e126a57d97bee3b86ab238e31738d1a36f /modules/hypernetworks/hypernetwork.py | |
parent | bcb6ad5fab6fb59fc79c8b6d94699cbabec34297 (diff) | |
parent | 44c27ebc7393ea793245aa565ace6c9bf1313980 (diff) | |
download | stable-diffusion-webui-gfx803-910d4f61e5a08c620dd5010665815e2694a55d11.tar.gz stable-diffusion-webui-gfx803-910d4f61e5a08c620dd5010665815e2694a55d11.tar.bz2 stable-diffusion-webui-gfx803-910d4f61e5a08c620dd5010665815e2694a55d11.zip |
Merge pull request #11720 from akx/closing
Use closing() with processing classes everywhere
Diffstat (limited to 'modules/hypernetworks/hypernetwork.py')
-rw-r--r-- | modules/hypernetworks/hypernetwork.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/hypernetworks/hypernetwork.py b/modules/hypernetworks/hypernetwork.py index 51941c11..79670b87 100644 --- a/modules/hypernetworks/hypernetwork.py +++ b/modules/hypernetworks/hypernetwork.py @@ -3,6 +3,7 @@ import glob import html
import os
import inspect
+from contextlib import closing
import modules.textual_inversion.dataset
import torch
@@ -711,8 +712,9 @@ def train_hypernetwork(id_task, hypernetwork_name, learn_rate, batch_size, gradi preview_text = p.prompt
- processed = processing.process_images(p)
- image = processed.images[0] if len(processed.images) > 0 else None
+ with closing(p):
+ processed = processing.process_images(p)
+ image = processed.images[0] if len(processed.images) > 0 else None
if unload:
shared.sd_model.cond_stage_model.to(devices.cpu)
|