33878e671a
Existing qwen2.5vl GGUFs can contain an empty qwen25vl.vision.fullatt_block_indexes array. The compat layer translated the projector metadata but left clip.vision.n_wa_pattern unset, causing llama-server to fail loading the CLIP model. Default the runtime compat value to the standard Qwen2.5-VL pattern when the key cannot be derived, and make the converter emit the same default for nil or empty fullatt block metadata. Fixes #16540
45 lines
887 B
Go
45 lines
887 B
Go
package convert
|
|
|
|
import (
|
|
"slices"
|
|
"testing"
|
|
)
|
|
|
|
func TestQwen25VLFullAttentionBlockDefaults(t *testing.T) {
|
|
tokenizer := &Tokenizer{Vocabulary: &Vocabulary{}}
|
|
|
|
for _, tt := range []struct {
|
|
name string
|
|
blocks []int32
|
|
want []int32
|
|
}{
|
|
{
|
|
name: "nil",
|
|
want: []int32{7, 15, 23, 31},
|
|
},
|
|
{
|
|
name: "empty",
|
|
blocks: []int32{},
|
|
want: []int32{7, 15, 23, 31},
|
|
},
|
|
{
|
|
name: "custom",
|
|
blocks: []int32{5, 17},
|
|
want: []int32{5, 17},
|
|
},
|
|
} {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
model := &qwen25VLModel{}
|
|
model.VisionModel.FullAttentionBlocks = tt.blocks
|
|
|
|
got, ok := model.KV(tokenizer)["qwen25vl.vision.fullatt_block_indexes"].([]int32)
|
|
if !ok {
|
|
t.Fatalf("fullatt_block_indexes has unexpected type %T", got)
|
|
}
|
|
if !slices.Equal(got, tt.want) {
|
|
t.Fatalf("fullatt_block_indexes = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|