aboutsummaryrefslogtreecommitdiff
path: root/modules/shared.py
diff options
context:
space:
mode:
authorMuhammad Rizqi Nur <rizqinur2010@gmail.com>2022-10-30 18:57:51 +0700
committerMuhammad Rizqi Nur <rizqinur2010@gmail.com>2022-10-30 18:57:51 +0700
commitcd4d59c0de446e6cae1db99ab1ad902b375a1e10 (patch)
tree8a09cbfceef69ebe3a3dab513a158a642923ab0c /modules/shared.py
parent05e2e40537a948d7563d873ffbc394c41a0cd0b1 (diff)
parent17a2076f72562b428052ee3fc8c43d19c03ecd1e (diff)
Merge master
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()