Commit bc108b9a authored by Jesse Gross's avatar Jesse Gross Committed by Jesse Gross
Browse files

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.
parent ef65174d
......@@ -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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment