Spaces:
Running
Running
Upload holo-load2bit.mjs with huggingface_hub
Browse files- holo-load2bit.mjs +4 -1
holo-load2bit.mjs
CHANGED
|
@@ -9,6 +9,7 @@
|
|
| 9 |
// transparently delegates to holo-load-delta.mjs, which reconstructs the finetune's blocks and returns the
|
| 10 |
// SAME { manifest, fetchTensor } shape — so the engine, KV-cache, and Q's brain loader need no changes.
|
| 11 |
import { f16ToF32 } from "./qvac-ingest.mjs";
|
|
|
|
| 12 |
|
| 13 |
async function gunzip(u8) { const ds = new DecompressionStream("gzip"); const w = ds.writable.getWriter(); w.write(u8); w.close(); return new Uint8Array(await new Response(ds.readable).arrayBuffer()); }
|
| 14 |
const hex = (buf) => [...new Uint8Array(buf)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
@@ -104,7 +105,9 @@ export async function loadKappaObject(baseUrl, opts = {}) {
|
|
| 104 |
// so the cache is untrusted-safe.
|
| 105 |
const getBlock = async (kappa) => {
|
| 106 |
const gz = await cachedBytes(baseUrl + "/b/" + kappa.replace(":", "_") + ".gz");
|
| 107 |
-
|
|
|
|
|
|
|
| 108 |
if (got !== kappa) throw new Error("κ MISMATCH " + kappa.slice(0, 24));
|
| 109 |
return await gunzip(gz);
|
| 110 |
};
|
|
|
|
| 9 |
// transparently delegates to holo-load-delta.mjs, which reconstructs the finetune's blocks and returns the
|
| 10 |
// SAME { manifest, fetchTensor } shape — so the engine, KV-cache, and Q's brain loader need no changes.
|
| 11 |
import { f16ToF32 } from "./qvac-ingest.mjs";
|
| 12 |
+
import { blake3hex } from "./holo-blake3.mjs"; // BLAKE3 σ-axis κ verify (opt-in via manifest.hash==="blake3") — the GPU-parallel tree hash
|
| 13 |
|
| 14 |
async function gunzip(u8) { const ds = new DecompressionStream("gzip"); const w = ds.writable.getWriter(); w.write(u8); w.close(); return new Uint8Array(await new Response(ds.readable).arrayBuffer()); }
|
| 15 |
const hex = (buf) => [...new Uint8Array(buf)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
|
|
| 105 |
// so the cache is untrusted-safe.
|
| 106 |
const getBlock = async (kappa) => {
|
| 107 |
const gz = await cachedBytes(baseUrl + "/b/" + kappa.replace(":", "_") + ".gz");
|
| 108 |
+
// Law L5: re-derive the κ. BLAKE3 (σ-axis, GPU-parallel tree hash) when the manifest declares it — the same
|
| 109 |
+
// hash the on-GPU verifier reproduces; else SHA-256 (SRI axis, default). Untrusted-CDN-safe either way.
|
| 110 |
+
const got = man.hash === "blake3" ? "blake3:" + blake3hex(gz) : "sha256:" + hex(await crypto.subtle.digest("SHA-256", gz));
|
| 111 |
if (got !== kappa) throw new Error("κ MISMATCH " + kappa.slice(0, 24));
|
| 112 |
return await gunzip(gz);
|
| 113 |
};
|