Skip to content
Merged
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
8 changes: 5 additions & 3 deletions vllm_gaudi/v1/worker/hpu_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,14 @@ def patch_llama4_get_attn_scale(model):
continue

attn = layer.self_attn
orig = attn._get_attn_scale

def _get_attn_scale_for_hpu(self, positions, _orig=orig):
def _get_attn_scale_for_hpu(self, positions):
if self.qk_norm is not None:
positions = positions.flatten()
return _orig(positions)
floor = torch.floor((positions + 1.0) / self.floor_scale)
attn_scale = torch.log(floor + 1.0) * self.attn_scale + 1.0

return attn_scale.unsqueeze(-1)

attn._get_attn_scale = types.MethodType(_get_attn_scale_for_hpu, attn)

Expand Down