Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
ProjectionCapSpec,
SteeringOp,
SteeringSpec,
SteerMethod,
SteerSpec,
VLLMModel,
)
Expand Down Expand Up @@ -255,7 +256,9 @@ def _feature_to_steerspec(
layer = address.layer
vector = torch.tensor(feature.steering_vector, dtype=torch.float32)
coeff = settings.strength_multiplier * feature.strength
method = "orthogonal" if settings.steer_method == NPSteerMethod.ORTHOGONAL_DECOMP else "additive"
method = (
SteerMethod.ORTHOGONAL if settings.steer_method == NPSteerMethod.ORTHOGONAL_DECOMP else SteerMethod.ADDITIVE
)

if name == "resid_post":
point, spec_layer = "resid_post", layer
Expand Down
2 changes: 1 addition & 1 deletion apps/inference/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies = [
# 1.8.0 adds `quantization=` and `kv_cache_dtype=` to load_model, which start.py's
# --quantization / --kv_cache_dtype pass through: FP8 on load is what fits Llama-3.3-70B
# on one 96 GB card. Nothing else on the surface this service calls changed.
"interp-engine[vllm,quant]==1.8.0",
"interp-engine[vllm,quant]==1.11.0",
]

[dependency-groups]
Expand Down
21 changes: 16 additions & 5 deletions apps/inference/tests/unit/test_vllm_capture_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,19 @@ def test_unknown_hidden_size_skips_the_check(self):


class TestAttentionRecomputeSharding:
def test_refuses_under_tensor_parallelism(self):
# q/k/v are head-sharded, and `dims` describes the whole model, so the reshape
# downstream would fail on the element count. Say why instead.
with pytest.raises(RuntimeError, match="tensor_parallel_size=4"):
vllm_backend.recompute_attn_from_payloads({}, [0], {}, 4)
def test_tensor_parallelism_is_accepted(self):
# The worker all-gathers q/k/v across ranks at collect, so rank 0's payload holds every
# head at any TP size and the recompute no longer refuses on the argument alone. The pod-level
# gate for sharded attention is inference's own (`vllm_attention_unsupported_reason`).
assert vllm_backend.recompute_attn_from_payloads({}, [], {}, 4) == {}

def test_a_shard_that_gets_through_is_named(self):
# `dims` describes the whole model, so a head-sharded capture is not a whole number of heads
# wide. The reshape would fail on the element count; the engine says what it saw instead.
with pytest.raises(ValueError, match="tensor-parallel shard"):
vllm_backend._heads_in(torch.zeros(19, 96), head_dim=64, which="q", layer=0)

def test_a_shard_that_divides_is_caught_against_the_config(self):
# Half the heads at the same head dim divides cleanly, so only the config's count exposes it.
with pytest.raises(ValueError, match="the config says 32"):
vllm_backend._heads_in(torch.zeros(19, 16 * 64), head_dim=64, which="q", layer=0, expected=32)
8 changes: 4 additions & 4 deletions apps/inference/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading