aboutsummaryrefslogtreecommitdiff
path: root/modules/shared.py
diff options
context:
space:
mode:
authorMartin Cairns <4314538+MartinCairnsSQL@users.noreply.github.com>2022-10-30 17:03:25 +0000
committerGitHub <noreply@github.com>2022-10-30 17:03:25 +0000
commit6c9e427c0eb6e48e367ea5c63c49ed8ac837b85e (patch)
tree7fb5368a73ab11a6b509d801842790d8cb1521d6 /modules/shared.py
parent34c86c12b0a9d650d4e7c5be478bca34ad8ed048 (diff)
parent17a2076f72562b428052ee3fc8c43d19c03ecd1e (diff)
Merge branch 'AUTOMATIC1111:master' into adjust-ddim-uniform-steps
Diffstat (limited to 'modules/shared.py')
-rw-r--r--modules/shared.py33
1 files changed, 31 insertions, 2 deletions
diff --git a/modules/shared.py b/modules/shared.py
index fb84afd8..e4f163c1 100644
--- a/modules/shared.py
+++ b/modules/shared.py
@@ -144,9 +144,38 @@ 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,
+ "interrupted": self.skipped,
+ "job": self.job,
+ "job_count": self.job_count,
+ "job_no": self.job_no,
+ "sampling_step": self.sampling_step,
+ "sampling_steps": self.sampling_steps,
+ }
+
+ 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()