Skip to content

Commit

Permalink
update: enable last_token pooling
Browse files Browse the repository at this point in the history
  • Loading branch information
kozistr committed Jan 6, 2025
1 parent 3df381a commit 1fe761f
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions backends/candle/src/models/flash_modernbert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,6 @@ impl FlashModernBertModel {
candle::bail!("`splade` is not supported for ModernBert")
}

if pool == Pool::LastToken {
candle::bail!("`last_token` is not supported for ModernBert");
}

(pool, None)
}
};
Expand Down Expand Up @@ -354,12 +350,9 @@ impl FlashModernBertModel {
}

let hidden_states = self.embeddings.forward(&input_ids)?;
let hidden_states = self.encoder.forward(
&hidden_states,
&cu_seqlens,
&rotary_cache,
max_length,
)?;
let hidden_states =
self.encoder
.forward(&hidden_states, &cu_seqlens, &rotary_cache, max_length)?;
let outputs = self.final_norm.forward(&hidden_states, None)?;

let has_pooling_requests = !batch.pooled_indices.is_empty();
Expand Down

0 comments on commit 1fe761f

Please sign in to comment.