[PR #9740] [MERGED] sample: add error handling for empty logits #18317

Closed
opened 2026-04-16 06:31:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/9740
Author: @ParthSareen
Created: 3/13/2025
Status: Merged
Merged: 3/20/2025
Merged by: @ParthSareen

Base: mainHead: parth/sample-greedy-fallback


📝 Commits (3)

  • 586557e sample: add greedy sample as fallback
  • 253b3c7 remove errors from sample, add tests
  • ffefbf4 add NaN check in sample

📊 Changes

3 files changed (+97 additions, -29 deletions)

View changed files

📝 sample/samplers.go (+7 -7)
📝 sample/samplers_test.go (+24 -0)
📝 sample/transforms_test.go (+66 -22)

📄 Description

  • Instead of erroring after sampling, we should return the highest probability token to avoid crashing
  • Also verified tokens are always returned in topp/minp

🔄 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/9740 **Author:** [@ParthSareen](https://github.com/ParthSareen) **Created:** 3/13/2025 **Status:** ✅ Merged **Merged:** 3/20/2025 **Merged by:** [@ParthSareen](https://github.com/ParthSareen) **Base:** `main` ← **Head:** `parth/sample-greedy-fallback` --- ### 📝 Commits (3) - [`586557e`](https://github.com/ollama/ollama/commit/586557eb5af7d351e83f4e3666d61ba875f66a59) sample: add greedy sample as fallback - [`253b3c7`](https://github.com/ollama/ollama/commit/253b3c7a2562355ae77edd4c862d2c1901b36f63) remove errors from sample, add tests - [`ffefbf4`](https://github.com/ollama/ollama/commit/ffefbf442a58552f6e84fba323f6ae07d71b947c) add NaN check in sample ### 📊 Changes **3 files changed** (+97 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `sample/samplers.go` (+7 -7) 📝 `sample/samplers_test.go` (+24 -0) 📝 `sample/transforms_test.go` (+66 -22) </details> ### 📄 Description - Instead of erroring after sampling, we should return the highest probability token to avoid crashing - Also verified tokens are always returned in topp/minp --- <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-16 06:31:45 -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#18317