Skip to content

Commit 9806a43

Browse files
authored
Adds support for Multimodal projector file (#104)
* Includes --proj if the model includes a Multimodal projector file * Fix test
1 parent 8b5d6ae commit 9806a43

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.23.7
55
require (
66
github.com/containerd/containerd/v2 v2.0.4
77
github.com/containerd/platforms v1.0.0-rc.1
8-
github.com/docker/model-distribution v0.0.0-20250627163720-aff34abcf3e0
8+
github.com/docker/model-distribution v0.0.0-20250710064845-ad2903dc93f7
99
github.com/google/go-containerregistry v0.20.3
1010
github.com/jaypipes/ghw v0.16.0
1111
github.com/mattn/go-shellwords v1.0.12

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBi
3838
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
3939
github.com/docker/docker-credential-helpers v0.8.2 h1:bX3YxiGzFP5sOXWc3bTPEXdEaZSeVMrFgOr3T+zrFAo=
4040
github.com/docker/docker-credential-helpers v0.8.2/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M=
41-
github.com/docker/model-distribution v0.0.0-20250627163720-aff34abcf3e0 h1:bve4JZI06Admw+NewtPfrpJXsvRnGKTQvBOEICNC1C0=
42-
github.com/docker/model-distribution v0.0.0-20250627163720-aff34abcf3e0/go.mod h1:dThpO9JoG5Px3i+rTluAeZcqLGw8C0qepuEL4gL2o/c=
41+
github.com/docker/model-distribution v0.0.0-20250710064845-ad2903dc93f7 h1:Kkiv0E3LTbj2y3rPRIJtRf89Eahg372RxqvKV14zszo=
42+
github.com/docker/model-distribution v0.0.0-20250710064845-ad2903dc93f7/go.mod h1:dThpO9JoG5Px3i+rTluAeZcqLGw8C0qepuEL4gL2o/c=
4343
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
4444
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
4545
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=

pkg/inference/backends/llamacpp/llamacpp_config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ func (c *Config) GetArgs(model types.Model, socket string, mode inference.Backen
7070
args = append(args, config.RuntimeFlags...)
7171
}
7272

73+
// Add arguments for Multimodal projector
74+
path, err := model.MMPROJPath()
75+
if path != "" && err == nil {
76+
args = append(args, "--mmproj", path)
77+
}
78+
7379
return args, nil
7480
}
7581

pkg/inference/backends/llamacpp/llamacpp_config_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package llamacpp
22

33
import (
4+
"errors"
45
"runtime"
56
"strconv"
67
"testing"
@@ -251,6 +252,10 @@ type fakeModel struct {
251252
config types.Config
252253
}
253254

255+
func (f *fakeModel) MMPROJPath() (string, error) {
256+
return "", errors.New("not found")
257+
}
258+
254259
func (f *fakeModel) ID() (string, error) {
255260
panic("shouldn't be called")
256261
}

pkg/inference/models/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ func (m *Manager) handleDeleteModel(w http.ResponseWriter, r *http.Request) {
333333
}
334334
}
335335

336-
if err := m.distributionClient.DeleteModel(r.PathValue("name"), force); err != nil {
336+
if _, err := m.distributionClient.DeleteModel(r.PathValue("name"), force); err != nil {
337337
if errors.Is(err, distribution.ErrModelNotFound) {
338338
http.Error(w, err.Error(), http.StatusNotFound)
339339
return

0 commit comments

Comments
 (0)