Skip to content

Commit

Permalink
fix chatglm
Browse files Browse the repository at this point in the history
Signed-off-by: Chendi.Xue <chendi.xue@intel.com>
  • Loading branch information
jikunshang authored and xuechendi committed Aug 28, 2024
1 parent 9abadba commit c539539
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vllm/hpu/rotary_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ def forward(self, positions: torch.Tensor, query: torch.Tensor,
else:
cos = cos[positions].unsqueeze(2)
sin = sin[positions].unsqueeze(2)
if self.dim != self.head_size:
assert (self.head_size % self.dim) == 0
num = self.head_size // self.dim
sin = sin.repeat(1,1,1,num)
cos = cos.repeat(1,1,1,num)
query, key = FusedRoPE.apply(query, cos, sin,
0), FusedRoPE.apply(key, cos, sin, 0)
return query.reshape(
Expand Down

0 comments on commit c539539

Please sign in to comment.