Skip to content

Commit 3b5e274

Browse files
committed
update to 1.5, better logging, build conf json
1 parent 8af38e2 commit 3b5e274

File tree

10 files changed

+58
-25
lines changed

10 files changed

+58
-25
lines changed

backends/stable_diffusion/diffusionbee_backend.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,22 @@ def __getattr__(self, attr):
9393

9494

9595
def download_weights():
96-
global p_14 , p_14_np
96+
global p_15 , p_15_np
9797

9898
print("sdbk mltl Loading Model")
9999

100100
is_downloaded = False
101101
for _ in range(10):
102102
try:
103103

104-
p_14 = ProgressBarDownloader(title="Downloading Model 1/2").download(
105-
url="https://huggingface.co/divamgupta/stable_diffusion_mps/resolve/main/sd-v1-4_fp16.tdict",
106-
md5_checksum="9f1fc1e94821d000b811e3bb6e7686b2",
104+
p_15 = ProgressBarDownloader(title="Downloading Model 1/2").download(
105+
url="https://huggingface.co/divamgupta/stable_diffusion_mps/resolve/main/sd-v1-5_fp16.tdict",
106+
md5_checksum="a36c79b8edb4b21b75e50d5834d1f4ae",
107107
verify_ssl=False,
108108
extract_zip=False,
109109
)
110110

111-
p_14_np = ProgressBarDownloader(title="Downloading Model 2/2").download(
111+
p_15_np = ProgressBarDownloader(title="Downloading Model 2/2").download(
112112
url="https://huggingface.co/divamgupta/stable_diffusion_mps/resolve/main/sd-v1-5-inpainting_fp16.tdict",
113113
md5_checksum="68303f49cca00968c39abddc20b622a6",
114114
verify_ssl=False,
@@ -139,10 +139,10 @@ def process_opt(d, generator):
139139

140140
if d['model_id'] == 1:
141141
model_mode = "inpaint_15"
142-
tdict_path = p_14_np
142+
tdict_path = p_15_np
143143
print("sdbk mdvr 1.5_inp")
144144
else:
145-
tdict_path = p_14
145+
tdict_path = p_15
146146
print("sdbk mdvr 1.4")
147147

148148
if d['do_controlnet'] == True:
@@ -262,7 +262,7 @@ def process_opt(d, generator):
262262

263263
def diffusion_bee_main():
264264

265-
global p_14 , p_14_np
265+
global p_15 , p_15_np
266266
download_weights()
267267

268268
print("sdbk mltl Loading Model")
@@ -277,7 +277,7 @@ def callback(state="" , progress=-1):
277277
if "__stop__" in get_input():
278278
return "stop"
279279

280-
generator = StableDiffusion( ModelInterface , p_14 , model_name="sd_1x", callback=callback, debug_output_path=debug_output_path )
280+
generator = StableDiffusion( ModelInterface , p_15 , model_name="sd_1x", callback=callback, debug_output_path=debug_output_path )
281281

282282

283283
default_d = { "W" : 512 , "H" : 512, "num_imgs":1 , "ddim_steps" : 25 ,

backends/stable_diffusion/stable_diffusion.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def prepare_model_interface(self , sd_run=None ):
235235

236236

237237
if self.current_model_name != model_name or self.current_dtype != dtype :
238-
print("Creating model interface")
238+
print("[SD] Creating model interface")
239239
assert tdict_path is not None
240240

241241
if self.model is not None:
@@ -279,7 +279,7 @@ def prepare_model_interface(self , sd_run=None ):
279279
if tdict_1 is None:
280280
tdict_1 = TDict(tdict_path)
281281

282-
print("Loading LoRA weights")
282+
print("[SD] Loading LoRA weights")
283283
extra_weights = add_lora_ti_weights(tdict_1 , weight_additions )
284284
self.model.load_from_state_dict(extra_weights )
285285
self.current_weight_additions = weight_additions
@@ -292,7 +292,7 @@ def tokenize(self , prompt):
292292
inputs = self.tokenizer.encode(prompt)
293293

294294
if len(inputs) >= 77:
295-
print("Prompt is too long, stripping it ")
295+
print("[SD] Prompt is too long, stripping it ")
296296
inputs = inputs[:77]
297297
if self.current_model_name == "sd_2x":
298298
phrase = inputs + [0] * (77 - len(inputs))
@@ -461,7 +461,6 @@ def prepare_init_latent(self , sd_run):
461461

462462
def t_to_i(self, t):
463463
i = list(self.scheduler.timesteps).index(t)
464-
print("t 2 i " , i )
465464
assert i >= 0
466465
return i
467466

backends/stable_diffusion/tests.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,27 @@ def test_lr_32():
434434

435435
# test_lr_1()
436436

437+
def test_11():
437438

438-
test_sd2_4()
439+
img = sd.generate(
440+
prompt="a tree" ,
441+
img_height=512,
442+
img_width=512,
443+
seed=1,
444+
tdict_path=None,
445+
batch_size=1,
446+
num_steps=5,
447+
dtype=ModelInterface.default_float_type,
448+
scheduler='ddim',
449+
mode="txt2img" )
450+
451+
gt_p = "./test_assets/outputs/a_tree_1_ddim.png"
452+
453+
Image.fromarray(img['img'][0]).show()
454+
455+
456+
457+
test_11()
439458

440459
exit()
441460

electron_app/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ pnpm-debug.log*
2323
*.sw?
2424

2525
#Electron-builder output
26-
/dist_electron
26+
/dist_electron
27+
28+
build_config.json

electron_app/afterSignHook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = async function (params) {
1010

1111
console.log('afterSign hook triggered', params);
1212

13-
let appId = 'com.linerai.diffusionbee'
13+
let appId = 'com.diffusionbee.diffusionbee'
1414

1515
let appPath = path.join(params.appOutDir, `${params.packager.appInfo.productFilename}.app`);
1616
if (!fs.existsSync(appPath)) {

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.3",
4-
"build_number": "0022",
3+
"version": "1.7.4",
4+
"build_number": "0023",
55
"website": "https://diffusionbee.com",
66
"description": "Diffusion Bee - Stable Diffusion App.",
77
"is_dev": false,

electron_app/src/components/ControlNet.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
-->
99

1010
<div v-if="inp_img" @drop.prevent="onDragFile" @dragover.prevent class="image_area" :class="{ crosshair_cur : is_inpaint }" style="height: calc(100% - 200px); border-radius: 16px; padding:5px;">
11-
<ImageCanvas ref="inp_img_canvas" :is_inpaint="is_inpaint" :image_source="inp_img" :is_disabled="!stable_diffusion.is_input_avail" canvas_id="img2imgcan" canvas_d_id="img2imgcand" ></ImageCanvas>
11+
<ImageCanvas ref="inp_img_canvas" :is_inpaint="is_inpaint" :image_source="inp_img" :is_disabled="!stable_diffusion.is_input_avail" canvas_id="ctrlnet" canvas_d_id="ctrlnetd" ></ImageCanvas>
1212
</div>
1313
<div v-else @drop.prevent="onDragFile" @dragover.prevent @click="open_input_image" class="image_area" :class="{ pointer_cursor : is_sd_active }" style="height: calc(100% - 200px); border-radius: 16px; padding:5px;">
1414
<center>

electron_app/src/components/Settings.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@
3636
</div>
3737
<hr> -->
3838
<div class="l_button button_colored" style="float:right" @click="add_model" >Add New Model</div>
39+
3940
<h2>Custom Models</h2>
41+
<p style="zoom:1"> Supported models : SD1.x , SD2.x - .ckpt and .safetensors </p>
42+
<p style="zoom:0.8"> Note: If you import SD2.x 768 model, you might need to use ddim_v sampler to get better results. </p>
43+
4044

4145
<!-- <br> -->
4246
<hr>

electron_app/src/components_bare/SDOptionsDropdown.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155

156156

157157
<b-form-select v-model="options_model_values.img_w"
158-
:options="[64 * 4, 64 * 5, 64 * 6, 64 * 7, 64 * 8, 64 * 9, 64 * 10, 64 * 11, 64 * 12]"
158+
:options="[64 * 4, 64 * 5, 64 * 6, 64 * 7, 64 * 8, 64 * 9, 64 * 10, 64 * 11, 64 * 12, 64*13 , 64*14]"
159159
required></b-form-select>
160160
</div>
161161
<div class="options_input" style="justify-content: center;width: 75px;">
@@ -175,7 +175,7 @@
175175
stroke-width="1.01368" stroke-linecap="round" stroke-linejoin="round" />
176176
</svg>
177177
<b-form-select v-model="options_model_values.img_h"
178-
:options="[64 * 4, 64 * 5, 64 * 6, 64 * 7, 64 * 8, 64 * 9, 64 * 10, 64 * 11, 64 * 12]"
178+
:options="[64 * 4, 64 * 5, 64 * 6, 64 * 7, 64 * 8, 64 * 9, 64 * 10, 64 * 11, 64 * 12, 64*13 , 64*14]"
179179
required></b-form-select>
180180
</div>
181181
</div>
@@ -259,7 +259,7 @@
259259
</svg>
260260

261261
<b-form-select v-model="options_model_values.selected_sampler"
262-
:options="['ddim' , 'lmsd' , 'pndm' , 'k_euler_ancestral' , 'k_euler' ]"
262+
:options="['ddim' , 'lmsd' , 'pndm' , 'k_euler_ancestral' , 'k_euler' , 'ddim_v' ]"
263263
required></b-form-select>
264264
</div>
265265
</div>

electron_app/vue.config.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11

2+
try {
3+
var build_config = require('./build_config.json');
4+
console.log(build_config + "\n\n\n\n\n")
5+
} catch (err) {
6+
var build_config = {}
7+
}
8+
9+
210
module.exports = {
311

412
pluginOptions: {
@@ -8,7 +16,8 @@ module.exports = {
816
// Or, for multiple preload files:
917
// preload: { preload: 'src/preload.js', otherPreload: 'src/preload2.js' }
1018
builderOptions: {
11-
appId: 'com.linerai.liner',
19+
appId: 'com.diffusionbee.diffusionbee',
20+
artifactName: "DiffusionBee"+(build_config.build_name||"")+"-${version}.${ext}",
1221
afterSign: "./afterSignHook.js",
1322
"extraResources": [{
1423
"from": process.env.BACKEND_BUILD_PATH ,
@@ -23,9 +32,9 @@ module.exports = {
2332
"hardenedRuntime": true,
2433
"entitlements": "build/entitlements.mac.plist",
2534
"entitlementsInherit": "build/entitlements.mac.plist",
26-
"minimumSystemVersion": "11.0.0",
35+
"minimumSystemVersion": build_config.min_os_version || "11.0.0",
2736
"extendInfo": {
28-
"LSMinimumSystemVersion": "11.0.0"
37+
"LSMinimumSystemVersion": build_config.min_os_version || "11.0.0"
2938
} ,
3039

3140
"target": {

0 commit comments

Comments
 (0)