llm, add a safeguard when a model causes swap-stopper to reset ollama.
This commit is contained in:
1 parent
295b6b3d19
commit
f6fd08f966
1 file changed
+7
@@ -913,11 +913,18 @@
|
|||||||
curl -s http://localhost:11434/api/generate \
|
curl -s http://localhost:11434/api/generate \
|
||||||
-d '{"model":"'$model'","prompt":"","stream":false,"keep_alive":1'$context'}' \
|
-d '{"model":"'$model'","prompt":"","stream":false,"keep_alive":1'$context'}' \
|
||||||
>/dev/null 2>&1
|
>/dev/null 2>&1
|
||||||
|
status=$?
|
||||||
|
|
||||||
hdd="`ollama ls | grep $model | awk '{print $3 $4}'`"
|
hdd="`ollama ls | grep $model | awk '{print $3 $4}'`"
|
||||||
ram="`ollama ps | grep $model | awk '{print $3 $4}'`"
|
ram="`ollama ps | grep $model | awk '{print $3 $4}'`"
|
||||||
ctx="`ollama ps | grep $model | awk '{print $7}'`"
|
ctx="`ollama ps | grep $model | awk '{print $7}'`"
|
||||||
|
|
||||||
|
if [[ "$status" != 0 ]]; then
|
||||||
|
ram="TOO LARGE $ram"
|
||||||
|
ctx="FAIL $ctx"
|
||||||
|
sleep 10
|
||||||
|
fi
|
||||||
|
|
||||||
printf "$spacing\n" "$model" "$hdd" "$ctx" "$ram"
|
printf "$spacing\n" "$model" "$hdd" "$ctx" "$ram"
|
||||||
|
|
||||||
ollama stop $model >/dev/null 2>&1
|
ollama stop $model >/dev/null 2>&1
|
||||||
|
|||||||
Reference in new issue
Block a user