Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

qwen-image: PSNR of the chained image in the oracle; the web shows the running step

JustVugg50d6eb17c3cb
diff --git a/c/qwenimage.c b/c/qwenimage.c
index f942b43e..fed9fa35 100644
--- a/c/qwenimage.c
+++ b/c/qwenimage.c
@@ -1162,9 +1162,22 @@ static int run_oracle(Engine *e, const char *refdir){
fails += big > rt->nbytes / 1000;
free(want);
}
- char out[2200]; snprintf(out, sizeof out, "%s/oracle_c.png", refdir);
+ const char *tag = getenv("QWENIMAGE_ORACLE_TAG");
+ char out[2200]; snprintf(out, sizeof out, "%s/oracle_c%s%s.png", refdir, tag ? "_" : "", tag ? tag : "");
qiv_decode(vae, mine, gh, gw, rgba, NULL);
if (!write_png(out, rgba, width, height)) fprintf(stderr, "[oracle] our own chained image: %s\n", out);
+ /* PSNR of the RGB of our chained image against the reference's: the
+ * number that says what int8 weights or activations cost in pixels */
+ if (rt && rt->nbytes == (int64_t)width * height * 4) {
+ uint8_t *want = xmalloc((size_t)rt->nbytes);
+ st_pread_full(rt->fd, want, rt->nbytes, rt->off, "rgba");
+ double se = 0; int64_t np3 = 0;
+ for (int64_t k = 0; k < rt->nbytes; k++) if ((k & 3) != 3) { double d = (double)rgba[k] - want[k]; se += d * d; np3++; }
+ double mse = se / np3;
+ fprintf(stderr, "[oracle] chained image vs reference: PSNR %.2f dB (MSE %.3f)\n",
+ mse > 0 ? 10.0 * log10(255.0 * 255.0 / mse) : 99.0, mse);
+ free(want);
+ }
free(img_ref); free(rgba); free(of);
qiv_free(vae);
}
diff --git a/web/src/components/ImageTurn.tsx b/web/src/components/ImageTurn.tsx
index f3b1fd9d..0c35c06a 100644
--- a/web/src/components/ImageTurn.tsx
+++ b/web/src/components/ImageTurn.tsx
@@ -46,7 +46,7 @@ export function ImageProgressCard({ request, run, onCancel }: { request: Generat
const progress = run.progress
const fraction = progressFraction(progress)
const stage = !progress ? t(run.plain ? "image.stage.working" : "image.stage.queued")
- : progress.stage === "denoise" ? t("image.stage.denoise", { step: Math.max(1, progress.step), steps: progress.steps })
+ : progress.stage === "denoise" ? t("image.stage.denoise", { step: Math.min(progress.steps, progress.step + 1), steps: progress.steps })
: progress.stage === "encode" || progress.stage === "decode" ? t(`image.stage.${progress.stage}`)
: t("image.stage.working")
return <div className="image-turn" style={turnWidth(request.width, request.height)}>