ACCC1380 commited on
Commit
5365a63
1 Parent(s): b2e55f2

Upload lora-scripts/gui.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. lora-scripts/gui.py +15 -4
lora-scripts/gui.py CHANGED
@@ -5,8 +5,8 @@ import platform
5
  import subprocess
6
  import sys
7
 
8
- from mikazuki.launch_utils import (base_dir_path, catch_exception,
9
- prepare_environment)
10
  from mikazuki.log import log
11
 
12
  parser = argparse.ArgumentParser(description="GUI for stable diffusion training")
@@ -14,8 +14,10 @@ parser.add_argument("--host", type=str, default="127.0.0.1")
14
  parser.add_argument("--port", type=int, default=28000, help="Port to run the server on")
15
  parser.add_argument("--listen", action="store_true")
16
  parser.add_argument("--skip-prepare-environment", action="store_true")
 
17
  parser.add_argument("--disable-tensorboard", action="store_true")
18
  parser.add_argument("--disable-tageditor", action="store_true")
 
19
  parser.add_argument("--tensorboard-host", type=str, default="127.0.0.1", help="Port to run the tensorboard")
20
  parser.add_argument("--tensorboard-port", type=int, default=6006, help="Port to run the tensorboard")
21
  parser.add_argument("--localization", type=str)
@@ -51,10 +53,19 @@ def run_tag_editor():
51
  def launch():
52
  log.info("Starting SD-Trainer Mikazuki GUI...")
53
  log.info(f"Base directory: {base_dir_path()}, Working directory: {os.getcwd()}")
54
- log.info(f'{platform.system()} Python {platform.python_version()} {sys.executable}')
55
 
56
  if not args.skip_prepare_environment:
57
- prepare_environment()
 
 
 
 
 
 
 
 
 
58
 
59
  os.environ["MIKAZUKI_HOST"] = args.host
60
  os.environ["MIKAZUKI_PORT"] = str(args.port)
 
5
  import subprocess
6
  import sys
7
 
8
+ from mikazuki.launch_utils import (base_dir_path, catch_exception, git_tag,
9
+ prepare_environment, check_port_avaliable, find_avaliable_ports)
10
  from mikazuki.log import log
11
 
12
  parser = argparse.ArgumentParser(description="GUI for stable diffusion training")
 
14
  parser.add_argument("--port", type=int, default=28000, help="Port to run the server on")
15
  parser.add_argument("--listen", action="store_true")
16
  parser.add_argument("--skip-prepare-environment", action="store_true")
17
+ parser.add_argument("--skip-prepare-onnxruntime", action="store_true")
18
  parser.add_argument("--disable-tensorboard", action="store_true")
19
  parser.add_argument("--disable-tageditor", action="store_true")
20
+ parser.add_argument("--disable-auto-mirror", action="store_true")
21
  parser.add_argument("--tensorboard-host", type=str, default="127.0.0.1", help="Port to run the tensorboard")
22
  parser.add_argument("--tensorboard-port", type=int, default=6006, help="Port to run the tensorboard")
23
  parser.add_argument("--localization", type=str)
 
53
  def launch():
54
  log.info("Starting SD-Trainer Mikazuki GUI...")
55
  log.info(f"Base directory: {base_dir_path()}, Working directory: {os.getcwd()}")
56
+ log.info(f"{platform.system()} Python {platform.python_version()} {sys.executable}")
57
 
58
  if not args.skip_prepare_environment:
59
+ prepare_environment(disable_auto_mirror=args.disable_auto_mirror, skip_prepare_onnxruntime=args.skip_prepare_onnxruntime)
60
+
61
+ if not check_port_avaliable(args.port):
62
+ avaliable = find_avaliable_ports(30000, 30000+20)
63
+ if avaliable:
64
+ args.port = avaliable
65
+ else:
66
+ log.error("port finding fallback error")
67
+
68
+ log.info(f"SD-Trainer Version: {git_tag(base_dir_path())}")
69
 
70
  os.environ["MIKAZUKI_HOST"] = args.host
71
  os.environ["MIKAZUKI_PORT"] = str(args.port)