aboutsummaryrefslogtreecommitdiffstats
path: root/modules/shared.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-10-30 06:10:22 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-10-30 06:10:22 +0000
commit149784202cca8612b43629c601ee27cfda64e623 (patch)
tree5e6121de8c0b0e935159f01fdedbb7b8a221f8b8 /modules/shared.py
parent060ee5d3a7ba258f944d0c891f90ac4a65411446 (diff)
downloadstable-diffusion-webui-gfx803-149784202cca8612b43629c601ee27cfda64e623.tar.gz
stable-diffusion-webui-gfx803-149784202cca8612b43629c601ee27cfda64e623.tar.bz2
stable-diffusion-webui-gfx803-149784202cca8612b43629c601ee27cfda64e623.zip
rework #3722 to not introduce duplicate code
Diffstat (limited to 'modules/shared.py')
-rw-r--r--modules/shared.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/modules/shared.py b/modules/shared.py
index f7b0990c..e4f163c1 100644
--- a/modules/shared.py
+++ b/modules/shared.py
@@ -144,9 +144,6 @@ class State:
self.sampling_step = 0
self.current_image_sampling_step = 0
- def get_job_timestamp(self):
- return datetime.datetime.now().strftime("%Y%m%d%H%M%S") # shouldn't this return job_timestamp?
-
def dict(self):
obj = {
"skipped": self.skipped,
@@ -160,6 +157,25 @@ class State:
return obj
+ def begin(self):
+ self.sampling_step = 0
+ self.job_count = -1
+ self.job_no = 0
+ self.job_timestamp = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
+ self.current_latent = None
+ self.current_image = None
+ self.current_image_sampling_step = 0
+ self.skipped = False
+ self.interrupted = False
+ self.textinfo = None
+
+ devices.torch_gc()
+
+ def end(self):
+ self.job = ""
+ self.job_count = 0
+
+ devices.torch_gc()
state = State()