Skip to content

Commit

Permalink
Fix indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
EricLBuehler committed May 9, 2024
1 parent 0b5d40a commit 33009bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mistralrs-core/src/models/quantized_phi3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ impl LayerWeights {
fn apply_rotary_emb(&self, xs: &Tensor, seqlen_offsets: &[usize]) -> Result<Tensor> {
let (_b_sz, _h, seq_len, _n_embd) = xs.dims4()?;
let mut outputs = Vec::new();
for offset in seqlen_offsets {
for (i, offset) in seqlen_offsets.iter().enumerate() {
let cos = self.cos.narrow(0, *offset, seq_len)?;
let sin = self.sin.narrow(0, *offset, seq_len)?;
outputs.push(candle_nn::rotary_emb::rope(
&xs.i(*offset)?.unsqueeze(0)?.contiguous()?,
&xs.i(i)?.unsqueeze(0)?.contiguous()?,
&cos,
&sin,
)?);
Expand Down

0 comments on commit 33009bd

Please sign in to comment.