Skip to content

Commit 25ef4f6

Browse files
committed
fix: populateFields must use GetTensor for split GGUF
CRITICAL FIX: - populateFields was calling Backend().Get() directly - This only searched main backend, missing projector tensors - Vision layer weights (norm1, norm2, etc.) were nil crash Fix: - Use base.GetTensor() which searches both backends - Add debug logging to track projector-loaded tensors - Recursive setPointer calls inherit the fix This should fix the nil pointer crash in LayerNorm.Forward.
1 parent 372e646 commit 25ef4f6

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

model/model.go

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -659,19 +659,12 @@ func populateFields(base Base, v reflect.Value, tags ...Tag) reflect.Value {
659659
for _, name := range names {
660660
tensorName := strings.Join(name, ".")
661661
// Use GetTensor to search both main and projector backends for split GGUF
662-
var tensor ml.Tensor
663-
if base.projectorBackend != nil {
664-
tensor = base.Backend().Get(tensorName)
665-
if tensor == nil {
666-
tensor = base.projectorBackend.Get(tensorName)
667-
if tensor != nil {
668-
slog.Info("SPLIT GGUF: ✓ populateFields loaded from PROJECTOR", "name", tensorName, "shape", tensor.Shape())
669-
}
670-
}
671-
} else {
672-
tensor = base.Backend().Get(tensorName)
673-
}
662+
tensor := base.GetTensor(tensorName)
674663
if tensor != nil {
664+
// Log if loaded from projector for split GGUF debugging
665+
if base.projectorBackend != nil && base.Backend().Get(tensorName) == nil {
666+
slog.Debug("SPLIT GGUF: tensor from projector", "name", tensorName, "shape", tensor.Shape())
667+
}
675668
logutil.Trace("found tensor", "", tensor)
676669
vv.Set(reflect.ValueOf(tensor))
677670
break

0 commit comments

Comments
 (0)