Humuhumu33 commited on
Commit
b5ae11e
·
verified ·
1 Parent(s): 4e8cc03

Upload holo-load2bit.mjs with huggingface_hub

Browse files
Files changed (1) hide show
  1. 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
- // OPT-IN (?verify=gpu → globalThis.__gpuVerify): re-derive on the GPU. Default = CPU BLAKE3 (the proven,
114
- // working path). GPU verify wired here fails during engine construction (2-device conflict see note);
115
- // needs a single-device refactor before it can be default. On any GPU error, fall back to CPU.
116
- if (typeof globalThis !== "undefined" && globalThis.__gpuVerify && gpuBlake3Available()) {
117
- try { const h = await gpuBlake3Hex(gz); got = "blake3:" + h; }
118
- catch (e) { got = "blake3:" + blake3hex(gz); }
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));