mlx: qwen3.5 vision support

This commit is contained in:
Patrick Devine
2026-03-17 15:34:56 -07:00
parent 126d8db7f3
commit 7e6e8377eb
12 changed files with 1947 additions and 170 deletions

View File

@@ -339,3 +339,34 @@ func TestCreateModelfileLayersIncludesParameters(t *testing.T) {
t.Fatalf("temperature = %v, want %v", got["temperature"], float64(0.7))
}
}
func TestSupportsVision(t *testing.T) {
t.Run("vision_config present", func(t *testing.T) {
cfg := parseModelConfig([]byte(`{
"vision_config": {"depth": 2},
"image_token_id": 151655
}`))
if !cfg.supportsVision() {
t.Fatal("supportsVision() = false, want true")
}
})
t.Run("token ids alone imply vision", func(t *testing.T) {
cfg := parseModelConfig([]byte(`{
"vision_start_token_id": 10,
"vision_end_token_id": 11
}`))
if !cfg.supportsVision() {
t.Fatal("supportsVision() = false, want true")
}
})
t.Run("plain text model", func(t *testing.T) {
cfg := parseModelConfig([]byte(`{
"architectures": ["Qwen3_5ForCausalLM"]
}`))
if cfg.supportsVision() {
t.Fatal("supportsVision() = true, want false")
}
})
}