ollama/model
Jesse Gross d00fac92e4 ollamarunner: Separate text and multimodal graphs
For some multimodal models (such as gemma3), we create a single
graph that generates the image embedding and then use this in the
text model. The embedding tensor is completely opaque to the runner.

However, this doesn't work if we need to use the embedding in multiple
batches. This can arise if the embedding is larger than the batch size.
In these cases (as with llama4), we would like to create views that
are more appropriately sized. However, if we do this then the original
source tensor is used in multiple graphs, which isn't allowed. To
avoid that problem, models with this pattern compute the embedding
tensor on first use and recreate the individual views. There is no
longer a single vision and text graph.

This codifies the pattern of separating vision and text graphs. The
logic of computing tensors on demand is moved to the runner, so models
no longer have to worry about this. It also gives the runner visibility
into the multimodal tensors, which is important for memory management.
2025-05-09 17:23:18 -07:00
..
imageproc imageproc mllama refactor (#7537) 2024-12-14 19:50:15 -08:00
input ollamarunner: Separate text and multimodal graphs 2025-05-09 17:23:18 -07:00
models ollamarunner: Separate text and multimodal graphs 2025-05-09 17:23:18 -07:00
testdata gemma2 impl 2025-03-11 14:35:08 -07:00
model.go ollamarunner: Separate text and multimodal graphs 2025-05-09 17:23:18 -07:00
model_test.go fs: move ml.Config to fs package 2025-04-03 13:12:24 -07:00
process_text.go fix token type 2025-04-25 16:59:01 -07:00
process_text_spm.go llama: remove model loading for grammar (#10096) 2025-04-24 11:51:19 -07:00
process_text_spm_test.go fix token type 2025-04-25 16:59:01 -07:00
process_text_test.go fix token type 2025-04-25 16:59:01 -07:00