[PR #10674] [MERGED] Multi-modal worst case graph #60016

Closed
opened 2026-04-29 14:56:14 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/10674
Author: @jessegross
Created: 5/12/2025
Status: Merged
Merged: 5/15/2025
Merged by: @jessegross

Base: mainHead: jessegross/worst-multimodal


📝 Commits (3)

  • 0f75589 ollamarunner: Base cached tokens on current prompt
  • 6c326f8 ollamarunner: Separate text and multimodal graphs
  • 7bd9f25 ollamarunner: Multi-modal worst case graph

📊 Changes

16 files changed (+319 additions, -190 deletions)

View changed files

📝 model/input/input.go (+20 -6)
📝 model/model.go (+5 -4)
📝 model/models/gemma3/model.go (+7 -7)
📝 model/models/gemma3/model_text.go (+1 -1)
📝 model/models/llama4/model.go (+53 -45)
📝 model/models/llama4/model_text.go (+1 -6)
📝 model/models/mistral3/model.go (+8 -33)
📝 model/models/mistral3/model_text.go (+1 -17)
📝 model/models/mllama/model.go (+5 -3)
📝 model/models/qwen25vl/model.go (+5 -34)
📝 model/models/qwen25vl/model_text.go (+1 -6)
📝 runner/llamarunner/cache.go (+1 -1)
📝 runner/ollamarunner/cache.go (+1 -1)
📝 runner/ollamarunner/cache_test.go (+6 -11)
runner/ollamarunner/multimodal.go (+116 -0)
📝 runner/ollamarunner/runner.go (+88 -15)

📄 Description

We currently preallocate compute graph memory for the worst case batch of text tokens. This adds support for doing the same for images.

Note that image models are more complicated than text models in how they process their inputs so there may be cases where this approach isn't completely generic for all models. It covers all currently supported models though.


🔄 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/10674 **Author:** [@jessegross](https://github.com/jessegross) **Created:** 5/12/2025 **Status:** ✅ Merged **Merged:** 5/15/2025 **Merged by:** [@jessegross](https://github.com/jessegross) **Base:** `main` ← **Head:** `jessegross/worst-multimodal` --- ### 📝 Commits (3) - [`0f75589`](https://github.com/ollama/ollama/commit/0f75589ee3e59ed9b0e24182db6e67336ea6fbf7) ollamarunner: Base cached tokens on current prompt - [`6c326f8`](https://github.com/ollama/ollama/commit/6c326f87d9bf81c9bafa68e14f92bdae98ff0a45) ollamarunner: Separate text and multimodal graphs - [`7bd9f25`](https://github.com/ollama/ollama/commit/7bd9f25cb2319d1c8da993ac62f7668f39127c54) ollamarunner: Multi-modal worst case graph ### 📊 Changes **16 files changed** (+319 additions, -190 deletions) <details> <summary>View changed files</summary> 📝 `model/input/input.go` (+20 -6) 📝 `model/model.go` (+5 -4) 📝 `model/models/gemma3/model.go` (+7 -7) 📝 `model/models/gemma3/model_text.go` (+1 -1) 📝 `model/models/llama4/model.go` (+53 -45) 📝 `model/models/llama4/model_text.go` (+1 -6) 📝 `model/models/mistral3/model.go` (+8 -33) 📝 `model/models/mistral3/model_text.go` (+1 -17) 📝 `model/models/mllama/model.go` (+5 -3) 📝 `model/models/qwen25vl/model.go` (+5 -34) 📝 `model/models/qwen25vl/model_text.go` (+1 -6) 📝 `runner/llamarunner/cache.go` (+1 -1) 📝 `runner/ollamarunner/cache.go` (+1 -1) 📝 `runner/ollamarunner/cache_test.go` (+6 -11) ➕ `runner/ollamarunner/multimodal.go` (+116 -0) 📝 `runner/ollamarunner/runner.go` (+88 -15) </details> ### 📄 Description We currently preallocate compute graph memory for the worst case batch of text tokens. This adds support for doing the same for images. Note that image models are more complicated than text models in how they process their inputs so there may be cases where this approach isn't completely generic for all models. It covers all currently supported models though. --- <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-29 14:56: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#60016