Skip to content

Commit e21c7a2

Browse files
polinabinder1claude
andcommitted
fix(evo2-sae): drop stale test_clamp_math + leaked server deps from the engine PR
- remove test_clamp_math: it called the deleted Evo2SAE._clamp_hook (we unified onto sae.steering.clamp_hook); the delta-clamp math is covered in sae/tests/test_steering.py - pyproject: drop fastapi/uvicorn/pandas — the engine imports none of them; fastapi+uvicorn move to the serve PR (#1637), pandas was unused Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Polina Binder <pbinder@nvidia.com>
1 parent 89d5451 commit e21c7a2

2 files changed

Lines changed: 6 additions & 34 deletions

File tree

bionemo-recipes/interpretability/sparse_autoencoders/recipes/evo2/pyproject.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ dependencies = [
1313
"torch>=2.0",
1414
"numpy>=1.20",
1515
"pyarrow>=23.0.0",
16-
"fastapi>=0.110",
17-
"uvicorn>=0.29",
18-
"pandas>=1.5",
1916
]
2017

21-
# The `evo2_sae` package (src/) holds the live inference engine + server + CLI;
22-
# scripts/ (extract, train) are standalone entry points alongside it.
18+
# The `evo2_sae` package (src/) holds the live inference engine + steering hook;
19+
# scripts/ (extract, train) are standalone entry points alongside it. The FastAPI
20+
# server + CLI (and their fastapi/uvicorn deps) are added by the serve PR (#1637).
2321
[tool.setuptools.packages.find]
2422
where = ["src"]
2523

bionemo-recipes/interpretability/sparse_autoencoders/recipes/evo2/tests/test_steering.py

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,9 @@
2929
import torch
3030

3131

32-
# --------------------------------------------------------------------- CPU: clamp math
33-
def test_clamp_math():
34-
"""The decode-only hook applies h <- h + Σ_f (target_f - relu((h-pre_bias)@enc_f + b_f))·dec_f."""
35-
from evo2_sae.core import Evo2SAE
36-
37-
H, F = 4, 2
38-
torch.manual_seed(0)
39-
pre_bias = torch.randn(H)
40-
enc = torch.randn(F, H)
41-
bias = torch.randn(F)
42-
dec = torch.randn(H, F)
43-
specs = [(enc[f], float(bias[f]), dec[:, f], float(f + 1)) for f in range(F)]
44-
45-
eng = Evo2SAE.__new__(Evo2SAE) # bare instance — exercise the hook only
46-
hook = eng._clamp_hook(specs, pre_bias)
47-
48-
h = torch.randn(1, 1, H) # one decode token: [S=1, B=1, H]
49-
out = hook(None, None, h)
50-
51-
xc = h - pre_bias
52-
expected = h.clone()
53-
for enc_f, b_f, dec_f, target in specs:
54-
a = torch.relu(xc @ enc_f + b_f)
55-
expected = expected + (target - a).unsqueeze(-1) * dec_f
56-
torch.testing.assert_close(out, expected)
57-
58-
# prefill (S>1) must be left untouched (continuation-only steering)
59-
prefill = torch.randn(5, 1, H)
60-
assert torch.equal(hook(None, None, prefill), prefill)
32+
# The delta-clamp math + decode-only/prefill behavior is covered against the production
33+
# hook in sae/tests/test_steering.py (sae.steering.clamp_hook). This file covers the
34+
# engine-level input guards (CPU) and the live steering smoke tests (GPU).
6135

6236

6337
# --------------------------------------------------- CPU: steering input guards (no model)

0 commit comments

Comments
 (0)