Skip to content

Commit 30209aa

Browse files
committed
tests, bug fixes, 1.7.1
1 parent 53c1718 commit 30209aa

File tree

7 files changed

+176
-35
lines changed

7 files changed

+176
-35
lines changed

backends/model_converter/tdict.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def init_read(self):
123123

124124
weights_json_start = extra_head[4]
125125
weights_json_l = extra_head[5] - extra_head[4]
126+
print( "json pos" , weights_json_start , weights_json_l)
126127

127128
self.ctdict_version = int(extra_head[3])
128129

backends/stable_diffusion/diffusionbee_backend.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,12 @@ def process_opt(d, generator):
243243

244244
def diffusion_bee_main():
245245

246-
247246
global p_14 , p_14_np
248247
download_weights()
248+
249249
print("sdbk mltl Loading Model")
250250

251+
251252
def callback(state="" , progress=-1):
252253
print("sdbk dnpr "+str(progress) )
253254
if state != "Generating":

backends/stable_diffusion/downloader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ def download(self, url, out_fname=None, md5_checksum=None,
104104
if os.path.exists(out_abs_path.replace(".zip", "")):
105105
# TODO , actually check if the extracted is valid, but then
106106
# you might need spereate md5
107+
print("sdbk mldn")
107108
return out_abs_path.replace(".zip", "")
108109
else:
110+
print("sdbk mldn")
109111
return out_abs_path
110112

111113
with open(out_abs_path, "wb") as f:
@@ -149,5 +151,5 @@ def download(self, url, out_fname=None, md5_checksum=None,
149151
out_abs_path = out_abs_path.replace(".zip", "")
150152
dest = shutil.move(extract_path, out_abs_path)
151153

152-
154+
print("sdbk mldn")
153155
return out_abs_path
11.8 KB
Loading
395 KB
Loading

backends/stable_diffusion/tests.py

Lines changed: 168 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,146 @@
1818

1919

2020

21+
def test_1():
22+
23+
img = sd.generate(
24+
prompt="a tree" ,
25+
img_height=512,
26+
img_width=512,
27+
seed=1,
28+
tdict_path=None,
29+
batch_size=1,
30+
dtype=ModelInterface.default_float_type,
31+
scheduler='ddim',
32+
mode="txt2img" )
33+
34+
gt_p = "./test_assets/outputs/a_tree_1_ddim.png"
35+
36+
Image.fromarray(img['img'][0]).show()
37+
38+
39+
40+
41+
42+
def test_2():
43+
44+
img = sd.generate(
45+
prompt="a fantasy tiger rightening , Fangs and tusks , massive square jaw with underbite , cybernetic eye , smoking lit cigar , Heavy and crude industrial sci " ,
46+
img_height=512,
47+
img_width=512,
48+
seed=145,
49+
tdict_path=None,
50+
batch_size=1,
51+
dtype=ModelInterface.default_float_type,
52+
scheduler='k_euler_ancestral',
53+
mode="txt2img" )
54+
gt_p = "./test_assets/outputs/tiger_k_euler_ancestral_145.png"
55+
56+
Image.fromarray(img['img'][0]).show()
57+
58+
59+
60+
61+
62+
def test_3():
63+
64+
img = sd.generate(
65+
prompt="a fantasy tiger rightening , Fangs and tusks , massive square jaw with underbite , cybernetic eye , smoking lit cigar , Heavy and crude industrial sci " ,
66+
img_height=512,
67+
img_width=512,
68+
seed=145,
69+
tdict_path=None,
70+
batch_size=1,
71+
dtype=ModelInterface.default_float_type,
72+
scheduler='lmsd',
73+
mode="txt2img" )
74+
gt_p = "./test_assets/outputs/tiger_lmsd_145.png"
75+
76+
Image.fromarray(img['img'][0]).show()
77+
78+
79+
def test_4():
80+
81+
img = sd.generate(
82+
prompt="a fantasy tiger rightening , Fangs and tusks , massive square jaw with underbite , cybernetic eye , smoking lit cigar , Heavy and crude industrial sci " ,
83+
img_height=512,
84+
img_width=512,
85+
seed=145,
86+
tdict_path=None,
87+
batch_size=1,
88+
dtype=ModelInterface.default_float_type,
89+
scheduler='pndm',
90+
mode="txt2img" )
91+
92+
gt_p = "./test_assets/outputs/tiger_pndm_145.png"
93+
94+
Image.fromarray(img['img'][0]).show()
95+
96+
97+
98+
def test_5():
99+
100+
inp = "./test_assets/mmm.png"
101+
mas = "./test_assets/ddd.png"
102+
103+
img = sd.generate(
104+
prompt="Face of red cat, high resolution, sitting on a park bench" ,
105+
img_height=512,
106+
img_width=512,
107+
seed=443136,
108+
input_image=inp,
109+
mask_image=mas,
110+
scheduler='ddim',
111+
tdict_path="/Users/divamgupta/.diffusionbee/downloads/sd-v1-5-inpainting_fp16.tdict",
112+
mode="inpaint_15" )
113+
114+
gt_p = "./test_assets/outputs/inp_out_443136.png"
115+
Image.fromarray(img['img'][0]).show()
116+
117+
118+
119+
def test_6():
120+
121+
inp = "./test_assets/mmm.png"
122+
mas = "./test_assets/ddd.png"
123+
124+
img = sd.generate(
125+
prompt="yellow cat, high resolution, sitting on a park bench" ,
126+
img_height=512,
127+
img_width=512,
128+
seed=678,
129+
input_image=inp,
130+
mask_image=mas,
131+
scheduler='ddim',
132+
tdict_path="/Users/divamgupta/.diffusionbee/downloads/sd-v1-5-inpainting_fp16.tdict",
133+
mode="inpaint_15" )
134+
gt_p = "./test_assets/outputs/inp_out_678.png"
135+
Image.fromarray(img['img'][0]).show()
136+
137+
138+
def test_7():
139+
140+
img = sd.generate(
141+
prompt="a tree" ,
142+
img_height=512,
143+
img_width=512,
144+
seed=1,
145+
batch_size=2,
146+
tdict_path=None,
147+
dtype=ModelInterface.default_float_type,
148+
scheduler='ddim',
149+
mode="txt2img" )
150+
151+
gt_p = "./test_assets/outputs/a_tree_1_ddim.png"
152+
gt_p2 = "./test_assets/outputs/a_tree_1_ddim_2.png"
153+
154+
155+
Image.fromarray(img['img'][0]).show()
156+
Image.fromarray(img['img'][1]).show()
157+
158+
159+
160+
21161

22162
# inp = "./test_assets/yoga1.jpg"
23163

@@ -43,46 +183,43 @@
43183

44184

45185

46-
inp = "./test_assets/scribble_turtle.png"
47-
48-
49-
img = sd.generate(
50-
prompt="a turtle" ,
51-
img_height=512,
52-
img_width=512,
53-
seed=6378,
54-
tdict_path=None,
55-
second_tdict_path="/Users/divamgupta/Downloads/just_control_sd15_scribble_fp16.tdict",
56-
batch_size=1,
57-
dtype=ModelInterface.default_float_type,
58-
scheduler='ddim',
59-
num_steps=25,
60-
input_image=inp,
61-
mode="controlnet" )
62-
63-
64-
Image.fromarray(img['img'][0]).show()
186+
# inp = "./test_assets/scribble_turtle.png"
65187

66188

189+
# img = sd.generate(
190+
# prompt="a turtle" ,
191+
# img_height=512,
192+
# img_width=512,
193+
# seed=6378,
194+
# tdict_path=None,
195+
# second_tdict_path="/Users/divamgupta/Downloads/just_control_sd15_scribble_fp16.tdict",
196+
# batch_size=1,
197+
# dtype=ModelInterface.default_float_type,
198+
# scheduler='ddim',
199+
# num_steps=25,
200+
# input_image=inp,
201+
# mode="controlnet" )
67202

68203

69-
img = sd.generate(
70-
prompt="a tortoise" ,
71-
img_height=512,
72-
img_width=512,
73-
seed=678,
74-
tdict_path=None,
75-
batch_size=1,
76-
dtype=ModelInterface.default_float_type,
77-
scheduler='ddim',
78-
input_image=inp,
79-
mode="txt2img" )
204+
# Image.fromarray(img['img'][0]).show()
80205

81206

82-
Image.fromarray(img[0]).show()
207+
# img = sd.generate(
208+
# prompt="a tortoise" ,
209+
# img_height=512,
210+
# img_width=512,
211+
# seed=678,
212+
# tdict_path=None,
213+
# batch_size=1,
214+
# dtype=ModelInterface.default_float_type,
215+
# scheduler='ddim',
216+
# input_image=inp,
217+
# mode="txt2img" )
83218

84219

220+
# Image.fromarray(img[0]).show()
85221

222+
test_7()
86223

87224

88225
exit()

electron_app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "DiffusionBee",
3-
"version": "1.7.0",
4-
"build_number": "0018",
3+
"version": "1.7.1",
4+
"build_number": "0019",
55
"website": "https://diffusionbee.com",
66
"description": "Diffusion Bee - Stable Diffusion App.",
77
"is_dev": false,

0 commit comments

Comments
 (0)