Spaces:
Sleeping
Sleeping
harden bf16 detection (no-op on cpu) + README: ungated Qwen default
Browse files- README.md +3 -1
- projection_map.py +5 -4
README.md
CHANGED
|
@@ -16,7 +16,9 @@ short_description: Interactive observability for transformer internals
|
|
| 16 |
Interactive observability for transformer internals: pick a focus word and a
|
| 17 |
control, and watch where the model ranks each — layer by layer — as it writes,
|
| 18 |
with rank‑band heatmaps, a per‑layer trace, a latency/closest‑cells log, and
|
| 19 |
-
threshold **suppress / stop** interventions
|
|
|
|
|
|
|
| 20 |
|
| 21 |
This **private/gated** build carries both projection methods side by side:
|
| 22 |
|
|
|
|
| 16 |
Interactive observability for transformer internals: pick a focus word and a
|
| 17 |
control, and watch where the model ranks each — layer by layer — as it writes,
|
| 18 |
with rank‑band heatmaps, a per‑layer trace, a latency/closest‑cells log, and
|
| 19 |
+
threshold **suppress / stop** interventions. Runs ungated
|
| 20 |
+
`Qwen/Qwen2.5-0.5B-Instruct` on CPU by default; set the `GRADIOGRAPHER_MODEL`
|
| 21 |
+
variable to swap in any compatible decoder (e.g. a `gemma-3` model, with access).
|
| 22 |
|
| 23 |
This **private/gated** build carries both projection methods side by side:
|
| 24 |
|
projection_map.py
CHANGED
|
@@ -103,10 +103,11 @@ def load_model(model_id):
|
|
| 103 |
|
| 104 |
# Use bfloat16 — Gemma 3's RMSNorm breaks with float16 (NaN logits).
|
| 105 |
# bfloat16 works on RTX 30+ / A100 / H100. Fall back to float32 if unavailable.
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
|
|
|
| 110 |
model = AutoModelForCausalLM.from_pretrained(
|
| 111 |
model_id, device_map="auto", torch_dtype=dtype
|
| 112 |
)
|
|
|
|
| 103 |
|
| 104 |
# Use bfloat16 — Gemma 3's RMSNorm breaks with float16 (NaN logits).
|
| 105 |
# bfloat16 works on RTX 30+ / A100 / H100. Fall back to float32 if unavailable.
|
| 106 |
+
try:
|
| 107 |
+
use_bf16 = torch.cuda.is_available() and torch.cuda.is_bf16_supported()
|
| 108 |
+
except Exception:
|
| 109 |
+
use_bf16 = False
|
| 110 |
+
dtype = torch.bfloat16 if use_bf16 else torch.float32
|
| 111 |
model = AutoModelForCausalLM.from_pretrained(
|
| 112 |
model_id, device_map="auto", torch_dtype=dtype
|
| 113 |
)
|