mirror of
https://github.com/likelovewant/ollama-for-amd.git
synced 2025-12-22 06:43:57 +00:00
ollamarunner: Suppress stack trace during memory allocation
Allocation failures can be a normal part of new memory estimates, so we shouldn't print a stack trace in this case.
This commit is contained in:
@@ -18,7 +18,6 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"runtime/debug"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -1101,9 +1100,13 @@ func (s *Server) allocModel(
|
|||||||
// Convert memory allocation panics to errors
|
// Convert memory allocation panics to errors
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
debug.PrintStack()
|
|
||||||
if err, ok := r.(error); ok {
|
if err, ok := r.(error); ok {
|
||||||
panicErr = err
|
var noMem ml.ErrNoMem
|
||||||
|
if errors.As(err, &noMem) {
|
||||||
|
panicErr = noMem
|
||||||
|
} else {
|
||||||
|
panic(r)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
panic(r)
|
panic(r)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user