Skip to content

Commit

Permalink
[rust] Make tensor contiguous in rotary embedding (#3436)
Browse files Browse the repository at this point in the history
  • Loading branch information
xyang16 authored Aug 21, 2024
1 parent 99ed366 commit 5c418be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extensions/tokenizers/rust/src/models/gte.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ impl RotaryEmbedding {
let (_b_sz, _h, seq_len, _n_embd) = q.dims4()?;
let cos = self.cos.narrow(0, 0, seq_len)?;
let sin = self.sin.narrow(0, 0, seq_len)?;
let q_embed = rotary_emb::rope(q, &cos, &sin)?;
let k_embed = rotary_emb::rope(k, &cos, &sin)?;
let q_embed = rotary_emb::rope(&q.contiguous()?, &cos, &sin)?;
let k_embed = rotary_emb::rope(&k.contiguous()?, &cos, &sin)?;
Ok((q_embed, k_embed))
}
}
Expand Down

0 comments on commit 5c418be

Please sign in to comment.