chaoliangUNSW commited on
Commit
ec580b8
·
verified ·
1 Parent(s): c62a185

Chunked attention on CUDA too (25K-token inputs fit a ZeroGPU slice)

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -60,8 +60,12 @@ import jev_style_decision as rt # noqa: E402 (the model repo's runtime, same c
60
 
61
  _t0 = time.perf_counter()
62
  MODEL = rt.JevStyleDecision(MODEL_DIR, device=DEVICE, dtype="float32", verify=True)
63
- print(f"{REPO}@{REVISION[:7]} loaded on {DEVICE} in {time.perf_counter() - _t0:.1f} s (float32, manifest ok)",
64
- flush=True)
 
 
 
 
65
 
66
  KINDS = ["Choice", "Yes / No", "Score"]
67
  OPTION_LABEL = {"Choice": "Options · one per line · name: description (optional)",
 
60
 
61
  _t0 = time.perf_counter()
62
  MODEL = rt.JevStyleDecision(MODEL_DIR, device=DEVICE, dtype="float32", verify=True)
63
+ # The runtime turns on its query-chunked attention only off CUDA. A ZeroGPU slice runs out of memory in plain SDPA
64
+ # near 25K tokens (float32 score matrix), so use the same chunked path on CUDA too.
65
+ if not MODEL.chunked_attention:
66
+ MODEL.chunked_attention = rt._enable_chunked_attention(MODEL.model, rt.ATTN_CHUNK)
67
+ print(f"{REPO}@{REVISION[:7]} loaded on {DEVICE} in {time.perf_counter() - _t0:.1f} s (float32, manifest ok, "
68
+ f"chunked attention {MODEL.chunked_attention})", flush=True)
69
 
70
  KINDS = ["Choice", "Yes / No", "Score"]
71
  OPTION_LABEL = {"Choice": "Options · one per line · name: description (optional)",