Spaces:
Running
Running
Upload holo-load2bit.mjs with huggingface_hub
Browse files- holo-load2bit.mjs +6 -6
holo-load2bit.mjs
CHANGED
|
@@ -110,12 +110,12 @@ export async function loadKappaObject(baseUrl, opts = {}) {
|
|
| 110 |
// hash the on-GPU verifier reproduces; else SHA-256 (SRI axis, default). Untrusted-CDN-safe either way.
|
| 111 |
let got;
|
| 112 |
if (man.hash === "blake3") {
|
| 113 |
-
//
|
| 114 |
-
//
|
| 115 |
-
//
|
| 116 |
-
if (typeof globalThis
|
| 117 |
-
try {
|
| 118 |
-
|
| 119 |
} else got = "blake3:" + blake3hex(gz);
|
| 120 |
} else got = "sha256:" + hex(await crypto.subtle.digest("SHA-256", gz));
|
| 121 |
if (got !== kappa) throw new Error("κ MISMATCH " + kappa.slice(0, 24));
|
|
|
|
| 110 |
// hash the on-GPU verifier reproduces; else SHA-256 (SRI axis, default). Untrusted-CDN-safe either way.
|
| 111 |
let got;
|
| 112 |
if (man.hash === "blake3") {
|
| 113 |
+
// DEFAULT: re-derive on the SHARED GPU device (2.74 GB/s). SAFE fallback: on any GPU error OR if the GPU
|
| 114 |
+
// digest disagrees with the pin, re-derive on the CPU — so a GPU quirk degrades to CPU speed, never fails
|
| 115 |
+
// the load. Only a CPU mismatch (real corruption) throws. Set globalThis.__gpuVerify=false to force CPU.
|
| 116 |
+
if (gpuBlake3Available() && (typeof globalThis === "undefined" || globalThis.__gpuVerify !== false)) {
|
| 117 |
+
try { got = "blake3:" + await gpuBlake3Hex(gz); } catch (e) { got = "blake3:" + blake3hex(gz); }
|
| 118 |
+
if (got !== kappa) got = "blake3:" + blake3hex(gz); // GPU disagreed → trust the CPU verifier
|
| 119 |
} else got = "blake3:" + blake3hex(gz);
|
| 120 |
} else got = "sha256:" + hex(await crypto.subtle.digest("SHA-256", gz));
|
| 121 |
if (got !== kappa) throw new Error("κ MISMATCH " + kappa.slice(0, 24));
|