Skip to content

Commit

Permalink
fix modernbert
Browse files Browse the repository at this point in the history
  • Loading branch information
akshayballal95 committed Jan 30, 2025
1 parent b94e987 commit d14d78a
Show file tree
Hide file tree
Showing 2 changed files with 199 additions and 31 deletions.
226 changes: 196 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion rust/src/embeddings/local/modernbert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ impl BertEmbed for ModernBertEmbedder {
let mut encodings: Vec<EmbeddingResult> = Vec::new();

for mini_text_batch in text_batch.chunks(batch_size) {
println!("mini_text_batch: {:?}", mini_text_batch.len());
let token_ids =
tokenize_batch(&self.tokenizer, mini_text_batch, &self.device)?;
let attention_mask = get_attention_mask(&self.tokenizer, text_batch, &self.device)?;
println!("token_ids: {:?}", token_ids.shape());
let attention_mask = get_attention_mask(&self.tokenizer, mini_text_batch, &self.device)?;
let embeddings: Tensor = self.model.forward(&token_ids, &attention_mask)?;
let pooled_output = self
.pooling
Expand Down

0 comments on commit d14d78a

Please sign in to comment.