[PR #13781] [MERGED] fix: prevent image generation models from loading during deletion #14386

Closed
opened 2026-04-13 00:52:31 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13781
Author: @jmorganca
Created: 1/19/2026
Status: Merged
Merged: 1/19/2026
Merged by: @jmorganca

Base: mainHead: fix-rm-image-model-loading


📝 Commits (1)

  • 8a3c019 fix: prevent image generation models from loading during deletion

📊 Changes

3 files changed (+101 additions, -9 deletions)

View changed files

📝 cmd/cmd.go (+2 -2)
📝 server/routes.go (+7 -7)
📝 server/routes_generate_test.go (+92 -0)

📄 Description

Move the unload check (empty prompt + KeepAlive=0) before the image generation model dispatch in GenerateHandler, but after the remote model code. This prevents models like flux from being loaded into memory just to be immediately unloaded when running ollama rm.

Also fix a bug in DeleteHandler where args[0] was used instead of arg in the delete loop, causing only the first model to be unloaded when deleting multiple models.


🔄 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/13781 **Author:** [@jmorganca](https://github.com/jmorganca) **Created:** 1/19/2026 **Status:** ✅ Merged **Merged:** 1/19/2026 **Merged by:** [@jmorganca](https://github.com/jmorganca) **Base:** `main` ← **Head:** `fix-rm-image-model-loading` --- ### 📝 Commits (1) - [`8a3c019`](https://github.com/ollama/ollama/commit/8a3c0198f65388d02e73f4ecb68b7891454ec0ba) fix: prevent image generation models from loading during deletion ### 📊 Changes **3 files changed** (+101 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+2 -2) 📝 `server/routes.go` (+7 -7) 📝 `server/routes_generate_test.go` (+92 -0) </details> ### 📄 Description Move the unload check (empty prompt + KeepAlive=0) before the image generation model dispatch in GenerateHandler, but after the remote model code. This prevents models like flux from being loaded into memory just to be immediately unloaded when running `ollama rm`. Also fix a bug in DeleteHandler where `args[0]` was used instead of `arg` in the delete loop, causing only the first model to be unloaded when deleting multiple models. --- <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:52:31 -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#14386