home · contact · privacy
Add timing info.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 26 Aug 2024 07:24:07 +0000 (09:24 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 26 Aug 2024 07:24:07 +0000 (09:24 +0200)
stable.py

index 29e1918017579b41f51919591f60a97c4a4324dc..484ac6e927ef72d164ffbbdbe123191b5cd24e2a 100755 (executable)
--- a/stable.py
+++ b/stable.py
@@ -3,6 +3,7 @@ from sys import argv, exit as sys_exit, stdin
 from os.path import dirname, basename, splitext, join as path_join, exists
 from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
 from random import randint
+from datetime import datetime
 from stable.gen_params import GenParams, GEN_PARAMS
 
 
@@ -120,6 +121,7 @@ def run():
     old_model_path = ''
     maker = None
     total = len(args.models) * args.quantity
+    start_time = datetime.now()
     for i, model_name in enumerate(args.models):
         new_model_path = path_join(args.models_dir, model_name)
         if new_model_path != old_model_path:
@@ -145,8 +147,13 @@ def run():
             gen_params.seed = start_seed + n + seed_corrector
             path = save_path(i*args.quantity + n)
             maker.set_gen_params(gen_params)
-            index = i*args.quantity + n
-            print(f'GENERATING {index}/{total}: {path}; {gen_params.to_str}')
+            index = i*args.quantity + n + 1
+            until_now = datetime.now() - start_time
+            until_end = ((until_now / index) * total) - until_now
+            print(f'GENERATING {index}/{total} '
+                  f'(time so far: {until_now[:-7]} / '
+                  f'estimated time left: {until_end[:-7]}): '
+                  f'{path}; {gen_params.to_str}')
             maker.gen_image_to(path)