Spaces:
Running
Running
KV-cache single-graph model (prefill once + k=2 decode internally)
Browse files- dit_fp16.onnx → genframe_fp16.onnx +2 -2
- index.html +13 -18
dit_fp16.onnx → genframe_fp16.onnx
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3fbbf2313f60065aaa83253bf91e8cd0b003903199326f2faa416b1488cacfef
|
| 3 |
+
size 261743145
|
index.html
CHANGED
|
@@ -194,7 +194,7 @@ async function boot_(){
|
|
| 194 |
|
| 195 |
setBar(.05);
|
| 196 |
setStatus("downloading dynamics model…");
|
| 197 |
-
const ditBuf=await fetchProgress("
|
| 198 |
setStatus("compiling dynamics on "+DEV+"…");
|
| 199 |
dit=await ort.InferenceSession.create(ditBuf,{executionProviders:eps, graphOptimizationLevel:"all"}); setBar(.85);
|
| 200 |
setStatus("downloading decoder…");
|
|
@@ -227,23 +227,18 @@ function curAction(){
|
|
| 227 |
}
|
| 228 |
|
| 229 |
async function genFrame(act){
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
const
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
const out=await dit.run({z:zT,t:tT,a:aT});
|
| 243 |
-
const v=out.v.data; const base=7*N;
|
| 244 |
-
for(let j=0;j<N;j++) cur[j]+=(1/K)*v[base+j];
|
| 245 |
-
}
|
| 246 |
-
return cur;
|
| 247 |
}
|
| 248 |
|
| 249 |
const oc=$("screen").getContext("2d"); const IMG=oc.createImageData(384,192);
|
|
|
|
| 194 |
|
| 195 |
setBar(.05);
|
| 196 |
setStatus("downloading dynamics model…");
|
| 197 |
+
const ditBuf=await fetchProgress("genframe_fp16.onnx","dynamics"); setBar(.7);
|
| 198 |
setStatus("compiling dynamics on "+DEV+"…");
|
| 199 |
dit=await ort.InferenceSession.create(ditBuf,{executionProviders:eps, graphOptimizationLevel:"all"}); setBar(.85);
|
| 200 |
setStatus("downloading decoder…");
|
|
|
|
| 227 |
}
|
| 228 |
|
| 229 |
async function genFrame(act){
|
| 230 |
+
// single graph does prefill(7 ctx frames) once + k decode steps internally (KV-cache)
|
| 231 |
+
const czbuf=new Float32Array(7*N);
|
| 232 |
+
for(let f=0;f<7;f++) czbuf.set(ctx[f], f*N);
|
| 233 |
+
const cabuf=new Float32Array(7*ROW);
|
| 234 |
+
for(let f=0;f<7;f++) cabuf.set(acts[f], f*ROW);
|
| 235 |
+
const out=await dit.run({
|
| 236 |
+
ctx_z:new ort.Tensor("float32",czbuf,[1,7,META.z_ch,META.hz,META.wz]),
|
| 237 |
+
ctx_a:new ort.Tensor("float32",cabuf,[1,7,ROW]),
|
| 238 |
+
cur_a:new ort.Tensor("float32",act,[1,ROW]),
|
| 239 |
+
noise:new ort.Tensor("float32",randn(N),[1,META.z_ch,META.hz,META.wz])
|
| 240 |
+
});
|
| 241 |
+
return out.cur.data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
}
|
| 243 |
|
| 244 |
const oc=$("screen").getContext("2d"); const IMG=oc.createImageData(384,192);
|