Skip to content

Commit 5d0a237

Browse files
committed
fix lmsd scheduler , cache md5 in filecheck
1 parent d6a0d4c commit 5d0a237

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

backends/stable_diffusion/downloader.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,19 @@
1919
import time
2020

2121
def get_md5_file(fpath):
22-
return str(hashlib.md5(open(fpath, 'rb').read()).hexdigest())
22+
23+
if os.path.exists(fpath + ".done"):
24+
cached = open(fpath + ".done").read()
25+
if "_" in cached:
26+
md_str = cached.split("_")[0]
27+
n_b = int(cached.split("_")[1])
28+
if n_b == os.path.getsize(fpath):
29+
return md_str
30+
31+
md_str = str(hashlib.md5(open(fpath, 'rb').read()).hexdigest())
32+
n_b = os.path.getsize(fpath)
33+
open(fpath + ".done" , "w").write(md_str + "_" + str(n_b))
34+
return md_str
2335

2436

2537
defualt_downloads_root = os.path.join(projects_root_path, "downloads")

backends/stable_diffusion/schedulers/scheduling_lms_discrete.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ def set_timesteps(self, num_inference_steps: int):
136136

137137
self.derivatives = []
138138

139+
self.initial_scale = self.sigmas[0]
140+
139141
self.set_format(tensor_format=self.tensor_format)
140142

141143
def step(

electron_app/src/bridge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function start_bridge() {
1616
console.log("starting bridge")
1717
const fs = require('fs')
1818

19-
let script_path = process.env.PY_SCRIPT || "./src/fake_backend.py";
19+
let script_path = process.env.PY_SCRIPT || "../backends/stable_diffusion/diffusionbee_backend.py";
2020
let bin_path = process.env.BIN_PATH;
2121
if(bin_path && (fs.existsSync(script_path))){
2222
python = require('child_process').spawn( bin_path );

electron_app/src/native_functions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ function add_custom_pytorch_models(pytorch_model_path, model_name, cb ){
463463
}
464464

465465

466-
let script_path = process.env.PY_SCRIPT || "./src/fake_backend.py";
466+
let script_path = process.env.PY_SCRIPT || "../backends/stable_diffusion/diffusionbee_backend.py";
467467

468468
let out_path = path.join(homedir , ".diffusionbee" , "custom_models" , model_name+".tdict" );
469469
let proc;

0 commit comments

Comments
 (0)