[PR #9586] [MERGED] sample: temporarily use grammars for constrained generation in new engine #13006

Closed
opened 2026-04-13 00:15:14 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/9586
Author: @jmorganca
Created: 3/7/2025
Status: Merged
Merged: 3/10/2025
Merged by: @jmorganca

Base: mainHead: jmorganca/use-llama-grammar


📝 Commits (6)

  • 2b1737a sample: temporarily use llama-based grammar constrained generation
  • 71a2674 remove panic
  • bdae765 lazy load vocab
  • 0436a54 return http error instead of logging one
  • d9e0943 add comment for vocab *sample.Vocab
  • d9e4b43 address comments

📊 Changes

10 files changed (+298 additions, -210 deletions)

View changed files

📝 llama/llama.go (+68 -0)
📝 llama/sampling_ext.cpp (+22 -0)
📝 llama/sampling_ext.h (+3 -0)
📝 llm/server.go (+16 -21)
📝 runner/ollamarunner/runner.go (+19 -4)
📝 sample/samplers.go (+135 -54)
📝 sample/samplers_benchmark_test.go (+8 -20)
📝 sample/samplers_test.go (+5 -89)
📝 sample/transforms.go (+8 -8)
📝 sample/transforms_test.go (+14 -14)

📄 Description

Adds constrained generation capabilities in new engine by using the existing grammar implementation


🔄 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/9586 **Author:** [@jmorganca](https://github.com/jmorganca) **Created:** 3/7/2025 **Status:** ✅ Merged **Merged:** 3/10/2025 **Merged by:** [@jmorganca](https://github.com/jmorganca) **Base:** `main` ← **Head:** `jmorganca/use-llama-grammar` --- ### 📝 Commits (6) - [`2b1737a`](https://github.com/ollama/ollama/commit/2b1737ab4e1c7724f75e757cc80e17ec0c1c91a4) sample: temporarily use llama-based grammar constrained generation - [`71a2674`](https://github.com/ollama/ollama/commit/71a26747a2088992e35a57239d741a9975b3b05b) remove panic - [`bdae765`](https://github.com/ollama/ollama/commit/bdae76585f04a934b072ca6146bcc87688437e60) lazy load vocab - [`0436a54`](https://github.com/ollama/ollama/commit/0436a5414b76a56f2ea6ab11afa276fe85d42d99) return http error instead of logging one - [`d9e0943`](https://github.com/ollama/ollama/commit/d9e0943e48a8a6ce18a3cbf8a98b68c2f7822f84) add comment for vocab *sample.Vocab - [`d9e4b43`](https://github.com/ollama/ollama/commit/d9e4b43d214021f12042e79d991d39bdf32bb1ee) address comments ### 📊 Changes **10 files changed** (+298 additions, -210 deletions) <details> <summary>View changed files</summary> 📝 `llama/llama.go` (+68 -0) 📝 `llama/sampling_ext.cpp` (+22 -0) 📝 `llama/sampling_ext.h` (+3 -0) 📝 `llm/server.go` (+16 -21) 📝 `runner/ollamarunner/runner.go` (+19 -4) 📝 `sample/samplers.go` (+135 -54) 📝 `sample/samplers_benchmark_test.go` (+8 -20) 📝 `sample/samplers_test.go` (+5 -89) 📝 `sample/transforms.go` (+8 -8) 📝 `sample/transforms_test.go` (+14 -14) </details> ### 📄 Description Adds constrained generation capabilities in new engine by using the existing grammar implementation --- <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-13 00:15:14 -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#13006