From bc108b9ad61da81a5d170e0f487b7603fbeb768f Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Thu, 10 Apr 2025 11:55:05 -0700 Subject: [PATCH] ggml: Log filesystem errors Sometimes loading the GGUF file fails with: panic: context canceled This is probably a filesystem error but it doesn't provide any information about what happened. --- ml/backend/ggml/ggml.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ml/backend/ggml/ggml.go b/ml/backend/ggml/ggml.go index 24bdd903d..5af39d75f 100644 --- a/ml/backend/ggml/ggml.go +++ b/ml/backend/ggml/ggml.go @@ -332,6 +332,7 @@ func New(ctx context.Context, r *os.File, params ml.BackendParams) (ml.Backend, // seeking around within an FD shared between all goroutines. file, err := os.Open(r.Name()) if err != nil { + slog.Warn("file open error", "file", r.Name(), "error", err) return err } defer file.Close() @@ -342,6 +343,7 @@ func New(ctx context.Context, r *os.File, params ml.BackendParams) (ml.Backend, for s < t.Size() { n, err := io.ReadFull(sr, bts[:min(len(bts), int(t.Size()-s))]) if err != nil { + slog.Warn("file read error", "file", r.Name(), "error", err) return err }