Humuhumu33 commited on
Commit
dfdc138
·
verified ·
1 Parent(s): 3365e13

Upload holo-load2bit.mjs with huggingface_hub

Browse files
Files changed (1) hide show
  1. holo-load2bit.mjs +5 -1
holo-load2bit.mjs CHANGED
@@ -43,8 +43,12 @@ async function cachedBytes(url) {
43
  // FAST FIRST LOAD: warm the whole block cache with bounded concurrency, so the engine's sequential per-tensor
44
  // reads hit the cache instead of paying one HF round-trip at a time (~1.5 blocks/s → tens of blocks/s over HTTP/2).
45
  // Fire-and-forget; the engine's getBlock shares any in-flight fetch (no double-download). Cross-origin-CDN safe.
46
- function prefetchBlocks(baseUrl, kappas, conc = 12) {
47
  try {
 
 
 
 
48
  const urls = [...new Set(kappas.filter(Boolean))].map((k) => baseUrl + "/b/" + String(k).replace(":", "_") + ".gz");
49
  let i = 0;
50
  const worker = async () => { while (i < urls.length) { const u = urls[i++]; try { await cachedBytes(u); } catch (e) {} } };
 
43
  // FAST FIRST LOAD: warm the whole block cache with bounded concurrency, so the engine's sequential per-tensor
44
  // reads hit the cache instead of paying one HF round-trip at a time (~1.5 blocks/s → tens of blocks/s over HTTP/2).
45
  // Fire-and-forget; the engine's getBlock shares any in-flight fetch (no double-download). Cross-origin-CDN safe.
46
+ function prefetchBlocks(baseUrl, kappas, conc) {
47
  try {
48
+ // HF serves over HTTP/2: many small blocks parallelize well, so fan out wide to saturate bandwidth (the one
49
+ // big embed block holds a single lane, the rest fill the others). Tunable via globalThis.__prefetchConc for
50
+ // constrained links/mobile. This is the whole first-load story for a resident κ-object — bandwidth, not RTT.
51
+ conc = conc || (typeof globalThis !== "undefined" && globalThis.__prefetchConc) || 24;
52
  const urls = [...new Set(kappas.filter(Boolean))].map((k) => baseUrl + "/b/" + String(k).replace(":", "_") + ".gz");
53
  let i = 0;
54
  const worker = async () => { while (i < urls.length) { const u = urls[i++]; try { await cachedBytes(u); } catch (e) {} } };