Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

runner.go: Don't try to extract image tags for text models

Jesse Gross71e6a0d0d181
diff --git a/llama/runner/runner.go b/llama/runner/runner.go
index 8762b3da6..0255ed557 100644
--- a/llama/runner/runner.go
+++ b/llama/runner/runner.go
@@ -164,10 +164,16 @@ func (s *Server) NewSequence(prompt string, images []ImageData, params NewSequen
// generating image embeddings for each image
func (s *Server) inputs(prompt string, images []ImageData) ([]input, error) {
var inputs []input
+ var parts []string
+ var matches [][]string
- re := regexp.MustCompile(`\[img-(\d+)\]`)
- parts := re.Split(prompt, -1)
- matches := re.FindAllStringSubmatch(prompt, -1)
+ if s.image != nil {
+ re := regexp.MustCompile(`\[img-(\d+)\]`)
+ parts = re.Split(prompt, -1)
+ matches = re.FindAllStringSubmatch(prompt, -1)
+ } else {
+ parts = []string{prompt}
+ }
for i, part := range parts {
// text - tokenize