[PR #15408] Grammar sampling message #41016

Open
opened 2026-04-23 01:46:13 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15408
Author: @clarismiranda
Created: 4/7/2026
Status: 🔄 Open

Base: mainHead: main


📝 Commits (3)

  • 01a3508 expose grammar
  • 3fe05bb modify showing grammar tokenbeing resample
  • 85a7219 update routes grammar nil

📊 Changes

7 files changed (+37 additions, -2 deletions)

View changed files

📝 api/types.go (+6 -0)
📝 llama/llama.go (+12 -0)
📝 llama/sampling_ext.cpp (+5 -0)
📝 llama/sampling_ext.h (+1 -0)
📝 llm/server.go (+3 -1)
📝 sample/samplers.go (+7 -1)
📝 server/routes.go (+3 -0)

📄 Description

Updated samplers.go to see which tokens fail to meet grammar criteria.
This involved changes in llama.go and sampling_ext to expose the ollama_vocab->token_to_piece(id)

I noticed the refactor from the old Ollama grammar version around this commit and, instead, the implementation of samplers.go. Why the change?


🔄 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/15408 **Author:** [@clarismiranda](https://github.com/clarismiranda) **Created:** 4/7/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (3) - [`01a3508`](https://github.com/ollama/ollama/commit/01a3508d15ecf678a021510cee0ca8cba5f876ab) expose grammar - [`3fe05bb`](https://github.com/ollama/ollama/commit/3fe05bb3c53eedb9190faaf59af56050b90b11ad) modify showing grammar tokenbeing resample - [`85a7219`](https://github.com/ollama/ollama/commit/85a7219874a0e0caad6247813e5d0a83668558f0) update routes grammar nil ### 📊 Changes **7 files changed** (+37 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `api/types.go` (+6 -0) 📝 `llama/llama.go` (+12 -0) 📝 `llama/sampling_ext.cpp` (+5 -0) 📝 `llama/sampling_ext.h` (+1 -0) 📝 `llm/server.go` (+3 -1) 📝 `sample/samplers.go` (+7 -1) 📝 `server/routes.go` (+3 -0) </details> ### 📄 Description Updated `samplers.go` to see which tokens fail to meet grammar criteria. This involved changes in `llama.go` and `sampling_ext` to expose the `ollama_vocab->token_to_piece(id)` I noticed the refactor from the old Ollama grammar version around this [commit](https://github.com/clarismiranda/ollama/commit/49a9c9ba6a345e3c4c17f5996bb3767c08e3d5bf#diff-1a25440df99b67ba493ae05c578e78e3c5a6ac49f232e13e4aa91dfefc655eaa) and, instead, the implementation of `samplers.go`. Why the change? --- <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-23 01:46:13 -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#41016