Skip to content
Merged
Changes from 1 commit
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
6 changes: 1 addition & 5 deletions vllm_spyre_next/vllm_spyre_next/custom_ops/rms_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ def forward_spyre(
if x.shape[-1] != hidden_size:
raise ValueError(f"Expected hidden_size to be {hidden_size}, but found: {x.shape[-1]}")

x = x.transpose(-1, -2).contiguous()

variance_epsilon = torch.full(
x.shape, variance_epsilon, dtype=torch.float16, device=x.device
)
Expand All @@ -147,11 +145,9 @@ def forward_spyre(

x_var = x[:, :, :variance_size_override]
Comment thread
bohnstingl marked this conversation as resolved.
Outdated

# After transpose, hidden dim is now dim=0
variance = x_var.pow(2).mean(dim=0, keepdim=True)
Comment thread
bohnstingl marked this conversation as resolved.
variance = x_var.pow(2).mean(dim=-1, keepdim=True)

x = x * torch.rsqrt(variance + variance_epsilon)
x = x.transpose(-1, -2).contiguous()

if weight is not None:
x = x * weight
Expand Down
Loading