forked from nerdyrodent/VQGAN-CLIP
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgenerateForProfiling.py
More file actions
57 lines (40 loc) · 1.4 KB
/
Copy pathgenerateForProfiling.py
File metadata and controls
57 lines (40 loc) · 1.4 KB
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
#######################################################################################
# preserves old function of running from command line args, and generating one image
#######################################################################################
import sys
import gc
sys.path.append('src')
from src import CmdLineArgs
CmdLineArgs.init()
from src import Hallucinator
from src import HallucinatorHelpers
from src import GenerationCommands
from src import GenerateJob
from src import ProfilerHelper
from PIL import ImageFile, PngImagePlugin
ImageFile.LOAD_TRUNCATED_IMAGES = True
#'cumulative'
#'tottime'
@ProfilerHelper.profile(sort_by='cumulative', lines_to_print=80, strip_dirs=False)
def Hallucinate(h, j):
# process the whole job in one go
h.ProcessJobFull( j )
def Run():
#################################
# start actually doing stuff here
#################################
# create the hallucinator class from commandline args
hallucinatorInst = HallucinatorHelpers.CreateHallucinatorFromArgParse( CmdLineArgs.args )
# create a job from the same argparse args
genJob = HallucinatorHelpers.CreateGenerationJobFromArgParse( hallucinatorInst, CmdLineArgs.args )
# flush, clean, go
sys.stdout.flush()
gc.collect()
try:
Hallucinate( hallucinatorInst, genJob)
except KeyboardInterrupt:
pass
########
# kick off Run()
########
Run()