[PR #9080] [MERGED] model: implement bert in ollama engine #44101

Closed
opened 2026-04-24 23:37:59 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/9080
Author: @mxyng
Created: 2/14/2025
Status: Merged
Merged: 9/15/2025
Merged by: @mxyng

Base: mainHead: mxyng/next-bert


📝 Commits (7)

📊 Changes

16 files changed (+490 additions, -40 deletions)

View changed files

📝 convert/convert_bert.go (+6 -2)
📝 ml/backend.go (+1 -0)
📝 ml/backend/ggml/ggml.go (+7 -0)
ml/nn/pooling/pooling.go (+36 -0)
📝 model/model.go (+6 -2)
model/models/bert/model.go (+181 -0)
📝 model/models/gemma2/model.go (+2 -2)
📝 model/models/gemma3/embed.go (+7 -17)
📝 model/models/gemma3/model.go (+2 -2)
📝 model/models/gemma3n/model.go (+2 -2)
📝 model/models/models.go (+1 -0)
📝 model/sentencepiece.go (+8 -8)
📝 model/sentencepiece_test.go (+4 -4)
model/wordpiece.go (+167 -0)
model/wordpiece_test.go (+51 -0)
📝 server/routes.go (+9 -1)

📄 Description

this change also fixes a bug with input truncation where it doesn't account for cls and sep tokens and so the result is off by two


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/9080 **Author:** [@mxyng](https://github.com/mxyng) **Created:** 2/14/2025 **Status:** ✅ Merged **Merged:** 9/15/2025 **Merged by:** [@mxyng](https://github.com/mxyng) **Base:** `main` ← **Head:** `mxyng/next-bert` --- ### 📝 Commits (7) - [`a1e7182`](https://github.com/ollama/ollama/commit/a1e7182a87c1afe71bd850ffe00c92a74e82e8dc) fix truncate - [`d7dbaa0`](https://github.com/ollama/ollama/commit/d7dbaa0c286c6589bf0bc168a1c3aa725123aba2) s/SentencePieceModel/SentencePiece/ - [`857108f`](https://github.com/ollama/ollama/commit/857108f4eb57ce195c28c533af1080a4a27aef71) bert - [`6ed2812`](https://github.com/ollama/ollama/commit/6ed28126240f7ef4beac3808cc0c5e2365ede2e7) wordpiece - [`fc8321d`](https://github.com/ollama/ollama/commit/fc8321d229d1c23b355b66566f7c63c7e737a14f) refactor pooling - [`209c3e5`](https://github.com/ollama/ollama/commit/209c3e5c822c969d18724b2864aaf8c0ed6bcf4f) more tokenizers - [`c437fdd`](https://github.com/ollama/ollama/commit/c437fdd9ffdcbd6bc70678f9ae1c749a462a43d7) normalize embeddings ### 📊 Changes **16 files changed** (+490 additions, -40 deletions) <details> <summary>View changed files</summary> 📝 `convert/convert_bert.go` (+6 -2) 📝 `ml/backend.go` (+1 -0) 📝 `ml/backend/ggml/ggml.go` (+7 -0) ➕ `ml/nn/pooling/pooling.go` (+36 -0) 📝 `model/model.go` (+6 -2) ➕ `model/models/bert/model.go` (+181 -0) 📝 `model/models/gemma2/model.go` (+2 -2) 📝 `model/models/gemma3/embed.go` (+7 -17) 📝 `model/models/gemma3/model.go` (+2 -2) 📝 `model/models/gemma3n/model.go` (+2 -2) 📝 `model/models/models.go` (+1 -0) 📝 `model/sentencepiece.go` (+8 -8) 📝 `model/sentencepiece_test.go` (+4 -4) ➕ `model/wordpiece.go` (+167 -0) ➕ `model/wordpiece_test.go` (+51 -0) 📝 `server/routes.go` (+9 -1) </details> ### 📄 Description this change also fixes a bug with input truncation where it doesn't account for cls and sep tokens and so the result is off by two --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-24 23:38:00 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#44101