[PR #2480] [MERGED] Fix negative keep_alive #10905

Closed
opened 2026-04-12 23:15:00 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/2480
Author: @bnorick
Created: 2/13/2024
Status: Merged
Merged: 2/13/2024
Merged by: @jmorganca

Base: mainHead: fix_keep_alive


📝 Commits (1)

📊 Changes

1 file changed (+2 additions, -4 deletions)

View changed files

📝 api/types.go (+2 -4)

📄 Description

Using a negative keep_alive did not work as expected, models would unload instantly. Some logging of the duration which was unmarshalled showed that the math.MaxFloat64 was resulting in a very large negative duration rather than the desired very large positive duration.

I just changed these codepaths to use math.MaxInt64, which is what I understand time.Duration to expect.


🔄 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/2480 **Author:** [@bnorick](https://github.com/bnorick) **Created:** 2/13/2024 **Status:** ✅ Merged **Merged:** 2/13/2024 **Merged by:** [@jmorganca](https://github.com/jmorganca) **Base:** `main` ← **Head:** `fix_keep_alive` --- ### 📝 Commits (1) - [`83c5526`](https://github.com/ollama/ollama/commit/83c552622637e8df0772eaecc4a307a841dd3510) Fix infinite keep_alive ### 📊 Changes **1 file changed** (+2 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `api/types.go` (+2 -4) </details> ### 📄 Description Using a negative `keep_alive` did not work as expected, models would unload instantly. Some logging of the duration which was unmarshalled showed that the `math.MaxFloat64` was resulting in a very large negative duration rather than the desired very large positive duration. I just changed these codepaths to use `math.MaxInt64`, which is what I understand `time.Duration` to expect. --- <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-12 23:15: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#10905