-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
90 lines (55 loc) · 2.61 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import logging
import time
from pathlib import Path
import fire
from sd_batch_runner.util import *
from sd_batch_runner.lora import update_lora_command,show_lora_command,show_lora_env_command,set_lora_env_command
from sd_batch_runner.generate import one_command,generate_command,show_checkpoint_command,set_default_checkpoint_command,show_controlnet_command
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
formatter = logging.Formatter("%(asctime)s %(name)s:%(lineno)s %(funcName)s [%(levelname)s]: %(message)s")
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logger.addHandler(handler)
###############################################################
class Command:
def __init__(self):
config_restore_files_if_needed()
def update_lora(self, is_overwrite=False):
start_tim = time.time()
update_lora_command(is_overwrite)
logger.info(f"Total Elapsed time : {time.time() - start_tim}")
def one(self,char="@random",style="@random",pose="@random",item=None,header="score_9, score_8_up, score_7_up, score_6_up, score_5_up, score_4_up, masterpiece, perfect face, perfect eyes",footer="zPDXL3",n=1):
start_tim = time.time()
one_command(char,style,pose,item,header,footer,n)
logger.info(f"Total Elapsed time : {time.time() - start_tim}")
def generate(self, json_path, n=1):
start_tim = time.time()
generate_command(Path(json_path),n)
clear_video_cache()
logger.info(f"Total Elapsed time : {time.time() - start_tim}")
def show_checkpoint(self):
start_tim = time.time()
show_checkpoint_command()
logger.info(f"Total Elapsed time : {time.time() - start_tim}")
def set_default_checkpoint(self, checkpoint_number):
start_tim = time.time()
set_default_checkpoint_command(checkpoint_number)
logger.info(f"Total Elapsed time : {time.time() - start_tim}")
def show_controlnet(self):
start_tim = time.time()
show_controlnet_command()
logger.info(f"Total Elapsed time : {time.time() - start_tim}")
def show_lora(self):
start_tim = time.time()
show_lora_command()
logger.info(f"Total Elapsed time : {time.time() - start_tim}")
def show_lora_env(self):
start_tim = time.time()
show_lora_env_command()
logger.info(f"Total Elapsed time : {time.time() - start_tim}")
def set_lora_env(self, new_env):
start_tim = time.time()
set_lora_env_command(new_env)
logger.info(f"Total Elapsed time : {time.time() - start_tim}")
fire.Fire(Command)