← back to Wallco Ai
refiner_compare: reorder into base pass then refiner pass — no checkpoint swap mid-pass; progress now counts 50 renders
f042d90ebfd18ae25ef37de9e2adb4b9120ef671 · 2026-05-19 12:16:00 -0700 · SteveStudio2
Files touched
M scripts/refiner_compare.jsM scripts/refiner_compare_watchdog.sh
Diff
commit f042d90ebfd18ae25ef37de9e2adb4b9120ef671
Author: SteveStudio2 <steve@designerwallcoverings.com>
Date: Tue May 19 12:16:00 2026 -0700
refiner_compare: reorder into base pass then refiner pass — no checkpoint swap mid-pass; progress now counts 50 renders
---
scripts/refiner_compare.js | 62 +++++++++++++++++++++----------------
scripts/refiner_compare_watchdog.sh | 8 ++---
2 files changed, 40 insertions(+), 30 deletions(-)
diff --git a/scripts/refiner_compare.js b/scripts/refiner_compare.js
index 75620da..92275cc 100644
--- a/scripts/refiner_compare.js
+++ b/scripts/refiner_compare.js
@@ -92,38 +92,48 @@ function render(workflow, outPath) {
}
(async () => {
- const rows = [];
const t0 = Date.now();
+ // Every row built up-front so the page shows all 25 slots immediately.
+ const rows = STYLES.map((style, i) => ({
+ i, style, brand: FASHION_PALETTES[i % FASHION_PALETTES.length].brand,
+ seed: 770000 + i, base: null, refiner: null,
+ }));
+ const TOTAL = STYLES.length * 2; // 50 renders: 25 base-only + 25 refiner
+ let nDone = 0;
+ const save = () => fs.writeFileSync(path.join(OUT, 'progress.json'),
+ JSON.stringify({ done: nDone, total: TOTAL, rows }, null, 1));
+ // resume-safe: a render that already produced a real file is skipped, so a
+ // crash + restart picks up where it left off instead of re-rendering pair 0.
+ const haveImg = p => { try { return fs.statSync(p).size > 1000; } catch { return false; } };
+ save();
+
+ // PASS 1 — every base-only render. Grouping all 25 together keeps ComfyUI's
+ // base checkpoint hot the whole pass instead of swapping it out each pair.
for (let i = 0; i < STYLES.length; i++) {
- const style = STYLES[i];
- const pal = FASHION_PALETTES[i % FASHION_PALETTES.length];
- const seed = 770000 + i;
- const POS = buildPos(style, pal);
- const baseFile = `${i}_base.png`, refFile = `${i}_refiner.png`;
- // row pushed up-front (base/refiner = null = "rendering"); progress.json
- // is rewritten after EVERY render so each image shows the instant it lands.
- const row = { i, style, brand: pal.brand, seed, base: null, refiner: null };
- rows.push(row);
- const save = done => fs.writeFileSync(path.join(OUT, 'progress.json'),
- JSON.stringify({ done, total: STYLES.length, rows }, null, 1));
- save(i);
- // resume-safe: a render that already produced a real file is skipped, so a
- // crash + restart picks up where it left off instead of re-rendering pair 0.
- const basePath = path.join(OUT, baseFile), refPath = path.join(OUT, refFile);
- const haveImg = p => { try { return fs.statSync(p).size > 1000; } catch { return false; } };
- if (haveImg(basePath)) { row.base = baseFile; console.log(` ${i} base — skip (already rendered)`); }
+ const style = STYLES[i], pal = FASHION_PALETTES[i % FASHION_PALETTES.length];
+ const seed = 770000 + i, POS = buildPos(style, pal);
+ const baseFile = `${i}_base.png`, basePath = path.join(OUT, baseFile);
+ if (haveImg(basePath)) { rows[i].base = baseFile; console.log(` ${i} base — skip (already rendered)`); }
else {
- try { row.base = render(baseWorkflow(seed, POS), basePath) ? baseFile : false; }
- catch (e) { row.base = false; console.log(` ${i} base ERR ${e.message}`); }
+ try { rows[i].base = render(baseWorkflow(seed, POS), basePath) ? baseFile : false; }
+ catch (e) { rows[i].base = false; console.log(` ${i} base ERR ${e.message}`); }
}
- save(i);
- if (haveImg(refPath)) { row.refiner = refFile; console.log(` ${i} refiner — skip (already rendered)`); }
+ nDone++; save();
+ console.log(`[base ${i + 1}/25] ${style} · ${pal.brand} — ${rows[i].base ? 'ok' : 'FAIL'} · ${((Date.now() - t0) / 60000).toFixed(1)}min`);
+ }
+
+ // PASS 2 — every base+refiner render, base+refiner checkpoints stay hot.
+ for (let i = 0; i < STYLES.length; i++) {
+ const style = STYLES[i], pal = FASHION_PALETTES[i % FASHION_PALETTES.length];
+ const seed = 770000 + i, POS = buildPos(style, pal);
+ const refFile = `${i}_refiner.png`, refPath = path.join(OUT, refFile);
+ if (haveImg(refPath)) { rows[i].refiner = refFile; console.log(` ${i} refiner — skip (already rendered)`); }
else {
- try { row.refiner = render(refinerWorkflow(seed, POS), refPath) ? refFile : false; }
- catch (e) { row.refiner = false; console.log(` ${i} refiner ERR ${e.message}`); }
+ try { rows[i].refiner = render(refinerWorkflow(seed, POS), refPath) ? refFile : false; }
+ catch (e) { rows[i].refiner = false; console.log(` ${i} refiner ERR ${e.message}`); }
}
- save(i + 1);
- console.log(`[${i + 1}/25] ${style} · ${pal.brand} — base:${row.base ? 'ok' : 'FAIL'} refiner:${row.refiner ? 'ok' : 'FAIL'} · ${((Date.now() - t0) / 1000 / 60).toFixed(1)}min`);
+ nDone++; save();
+ console.log(`[refiner ${i + 1}/25] ${style} · ${pal.brand} — ${rows[i].refiner ? 'ok' : 'FAIL'} · ${((Date.now() - t0) / 60000).toFixed(1)}min`);
}
// compare page
diff --git a/scripts/refiner_compare_watchdog.sh b/scripts/refiner_compare_watchdog.sh
index fc96663..b225dae 100755
--- a/scripts/refiner_compare_watchdog.sh
+++ b/scripts/refiner_compare_watchdog.sh
@@ -8,17 +8,17 @@ LOG=/tmp/refiner_compare.log
restarts=0
while true; do
done=$(python3 -c "import json;print(json.load(open('$PROG'))['done'])" 2>/dev/null || echo 0)
- if [ "${done:-0}" -ge 25 ]; then
- echo "$(date '+%H:%M:%S') job complete ($done/25) — watchdog exiting after $restarts restart(s)"
+ if [ "${done:-0}" -ge 50 ]; then
+ echo "$(date '+%H:%M:%S') job complete ($done/50 renders) — watchdog exiting after $restarts restart(s)"
break
fi
if ! pgrep -f 'scripts/refiner_compare.js' >/dev/null 2>&1; then
if [ "$restarts" -ge 30 ]; then
- echo "$(date '+%H:%M:%S') hit 30-restart cap at $done/25 — giving up, check $LOG"
+ echo "$(date '+%H:%M:%S') hit 30-restart cap at $done/50 — giving up, check $LOG"
break
fi
restarts=$((restarts+1))
- echo "$(date '+%H:%M:%S') refiner_compare.js not running (at $done/25) — restart #$restarts"
+ echo "$(date '+%H:%M:%S') refiner_compare.js not running (at $done/50 renders) — restart #$restarts"
nohup node scripts/refiner_compare.js >> "$LOG" 2>&1 &
sleep 5
fi
← 838379d add refiner_compare watchdog — auto-restart on crash, exit o
·
back to Wallco Ai
·
refiner_compare: two-machine split — CMP_SHARD/CMP_SHARDS en 9b5ec50 →