Spaces:
Running on Zero
Running on Zero
Chunked attention on CUDA too (25K-token inputs fit a ZeroGPU slice)
Browse files
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 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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)",
|