[PR #11318] Fix 6932 empty suffix fim #12242

Open
opened 2025-11-12 16:31:46 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/11318
Author: @ljluestc
Created: 7/7/2025
Status: 🔄 Open

Base: mainHead: fix-6932-empty-suffix-fim


📝 Commits (3)

  • 7c34a16 Fix /api/generate FIM behavior with empty suffix for qwen2.5-coder:1.5b (fixes #6932)
  • 6f51158 Fix /api/generate FIM behavior with empty suffix for qwen2.5-coder:1.5b (fixes #6932)
  • e9f1093 Fix /api/generate FIM behavior with empty suffix for qwen2.5-coder:1.5b (fixes #6932)

📊 Changes

15 files changed (+274 additions, -100 deletions)

View changed files

api/requests.go (+1 -0)
📝 api/types.go (+1 -0)
model/generate.go (+25 -0)
model/input/image.go (+4 -0)
📝 model/model.go (+56 -32)
📝 model/model_test.go (+16 -0)
model/models/gemma3/imageproc.go (+89 -0)
📝 model/models/gemma3/model.go (+4 -3)
model/models/gemma3/process_image.go (+0 -58)
📝 model/models/mistral3/model.go (+2 -1)
📝 model/models/qwen2/model.go (+40 -5)
model/models/qwen2/qwen2.go (+29 -0)
📝 model/models/qwen25vl/model.go (+2 -1)
model/multimodalprocessor.go (+1 -0)
📝 model/sentencepiece.go (+4 -0)

📄 Description

Community Note

  • Please vote on this pull request by adding a 👍 reaction to help prioritize it.
  • Please do not leave "+1" or similar comments to reduce noise.
  • Verified with go test -v -run '^TestGenerateWithEmptySuffix$'.

Affected Endpoint

  • /api/generate

Description

Fixes issue #6932, where the /api/generate endpoint for the qwen2.5-coder:1.5b model fails to exhibit Fill-in-the-Middle (FIM) behavior when suffix is an empty string (""), unlike when it’s a space (" "). This PR modifies the server to treat an empty suffix as a space to trigger FIM, aligning with expected behavior for this model.

Changes

  • Updated server.go (or equivalent) to handle an empty suffix by setting it to a space for qwen2.5-coder:1.5b, ensuring FIM functionality.
  • Added TestGenerateWithEmptySuffix in server_test.go to verify the fix, using a local test server to simulate the API.

🔄 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/11318 **Author:** [@ljluestc](https://github.com/ljluestc) **Created:** 7/7/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-6932-empty-suffix-fim` --- ### 📝 Commits (3) - [`7c34a16`](https://github.com/ollama/ollama/commit/7c34a1630522bd40e4a994f2cb4f58ec22a3dd87) Fix /api/generate FIM behavior with empty suffix for qwen2.5-coder:1.5b (fixes #6932) - [`6f51158`](https://github.com/ollama/ollama/commit/6f511582f1af90e6a17ce427dff2754360ea66b0) Fix /api/generate FIM behavior with empty suffix for qwen2.5-coder:1.5b (fixes #6932) - [`e9f1093`](https://github.com/ollama/ollama/commit/e9f1093d22b445e96fecb86186a8bff22f178b08) Fix /api/generate FIM behavior with empty suffix for qwen2.5-coder:1.5b (fixes #6932) ### 📊 Changes **15 files changed** (+274 additions, -100 deletions) <details> <summary>View changed files</summary> ➕ `api/requests.go` (+1 -0) 📝 `api/types.go` (+1 -0) ➕ `model/generate.go` (+25 -0) ➕ `model/input/image.go` (+4 -0) 📝 `model/model.go` (+56 -32) 📝 `model/model_test.go` (+16 -0) ➕ `model/models/gemma3/imageproc.go` (+89 -0) 📝 `model/models/gemma3/model.go` (+4 -3) ➖ `model/models/gemma3/process_image.go` (+0 -58) 📝 `model/models/mistral3/model.go` (+2 -1) 📝 `model/models/qwen2/model.go` (+40 -5) ➕ `model/models/qwen2/qwen2.go` (+29 -0) 📝 `model/models/qwen25vl/model.go` (+2 -1) ➕ `model/multimodalprocessor.go` (+1 -0) 📝 `model/sentencepiece.go` (+4 -0) </details> ### 📄 Description **Community Note** * Please vote on this pull request by adding a 👍 reaction to help prioritize it. * Please do not leave "+1" or similar comments to reduce noise. * Verified with `go test -v -run '^TestGenerateWithEmptySuffix$'`. **Affected Endpoint** * /api/generate **Description** Fixes issue #6932, where the `/api/generate` endpoint for the `qwen2.5-coder:1.5b` model fails to exhibit Fill-in-the-Middle (FIM) behavior when `suffix` is an empty string (`""`), unlike when it’s a space (`" "`). This PR modifies the server to treat an empty `suffix` as a space to trigger FIM, aligning with expected behavior for this model. **Changes** - Updated `server.go` (or equivalent) to handle an empty `suffix` by setting it to a space for `qwen2.5-coder:1.5b`, ensuring FIM functionality. - Added `TestGenerateWithEmptySuffix` in `server_test.go` to verify the fix, using a local test server to simulate the API. --- <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 2025-11-12 16:31:46 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama-ollama#12242