forked from vipermu/aphantasia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
arguments.py
125 lines (115 loc) · 2.62 KB
/
arguments.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import argparse
model_list = ['ViT-B/32', 'RN50', 'RN50x4', 'RN101']
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
'--input_text',
default=None,
help='input text',
)
parser.add_argument(
'--micro_text',
default=None,
help='input text for small details',
)
parser.add_argument(
'--substract_text',
default=None,
help='input text to subtract',
)
parser.add_argument(
'--out_dir',
default='_out',
)
parser.add_argument(
'--size',
default='1280-720',
help='Output resolution',
)
parser.add_argument(
'--save_freq',
default=1,
type=int,
help='Saving step',
)
parser.add_argument(
'--save_pt',
action='store_true',
help='Save FFT snapshots for further use',
)
parser.add_argument(
'--batch_size',
default=1,
type=int,
help='Batch size generation',
)
# training
parser.add_argument(
'--model',
default='ViT-B/32',
choices=model_list,
help='Select CLIP model to use',
)
parser.add_argument(
'--num_steps',
default=200,
type=int,
help='Total iterations',
)
parser.add_argument(
'--num_crops',
default=200,
type=int,
help='Samples to evaluate',
)
parser.add_argument(
'--lrate',
default=0.05,
type=float,
help='Learning rate',
)
parser.add_argument(
'--prog',
action='store_true',
help='Enable progressive lrate growth (up to double a.lrate)',
)
# tweaks
parser.add_argument(
'--contrast',
default=1.,
type=float,
)
parser.add_argument(
'--colors',
default=1.,
type=float,
)
parser.add_argument(
'--decay',
default=1,
type=float,
)
parser.add_argument(
'--noise',
default=0,
type=float,
help='Add noise to suppress accumulation',
) # < 0.05 ?
parser.add_argument(
'--sync',
default=0,
type=float,
help='Sync output to input image',
)
parser.add_argument(
'--invert',
action='store_true',
help='Invert criteria',
)
args = parser.parse_args()
if args.size is not None:
args.size = [int(s) for s in args.size.split('-')][::-1]
if len(args.size) == 1:
args.size = args.size * 2
args.modsize = 288 if args.model == 'RN50x4' else 224
return args