-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprefs.py
executable file
·52 lines (42 loc) · 1.49 KB
/
prefs.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
import json
import os
config = {}
config_name = "config.json"
def init():
global config
if os.path.exists(config_name):
config = json.load(open(config_name))
else:
config = json.load(open('default_prefs.json'))
def set_config(url, model, pos, neg, dimensions, direction, batch, seed, steps, cfg, sampler_name, scheduler, clip, b1, b2, s1, s2, rescale):
global config
config["main"] = {}
config["settings"] = {}
config["settings"]["url"] = url
config["main"]["model"] = model
config["main"]["pos"] = pos
config["main"]["neg"] = neg
config["main"]["dimensions"] = dimensions
config["main"]["direction"] = direction
config["main"]["batch"] = batch
config["main"]["seed"] = seed
config["main"]["steps"] = steps
config["main"]["cfg"] = cfg
config["main"]["sampler_name"] = sampler_name
config["main"]["scheduler"] = scheduler
config["main"]["clip"] = clip
config["main"]["b1"] = b1
config["main"]["b2"] = b2
config["main"]["s1"] = s1
config["main"]["s2"] = s2
config["main"]["rescale"] = rescale
with open(config_name, 'w', encoding='utf-8') as f:
json.dump(config, f, ensure_ascii=False, indent=4)
def generation_info():
info = """
**Positive:** {pos}
**Negative:** {neg}
{dimensions} {direction} **Seed:** {seed} **CFG:** {cfg} {sampler_name} {scheduler} **Clip:** {clip}
**FreeU_v2:** [{b1},{b2},{s1},{s2}] **Rescale CFG:** {rescale}
""".format(**config["main"])
return info