Let more then one model beeing pushed

This commit is contained in:
SvenBrnn
2025-01-24 12:09:39 +00:00
parent a3641d7d00
commit df9f59ffb1
3 changed files with 21 additions and 15 deletions
+16 -11
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#!/bin/bash
# Start the Ollama server in the background
echo "Starting Ollama server to preload model: $MODEL_NAME"
echo "Starting Ollama server to preload models: $MODEL_NAMES"
ollama serve &
# Capture the PID of the Ollama server
@@ -11,15 +11,20 @@ OLLAMA_PID=$!
echo "Waiting for Ollama server to start..."
sleep 5
# Pull the specified model
echo "Pulling model: $MODEL_NAME"
if ollama pull "$MODEL_NAME"; then
echo "Successfully pulled model: $MODEL_NAME"
else
echo "Failed to pull model: $MODEL_NAME"
kill $OLLAMA_PID
exit 1
fi
# Split the comma-separated model names into an array
IFS=',' read -r -a MODELS <<< "$MODEL_NAMES"
# Loop through each model and pull it
for MODEL_NAME in "${MODELS[@]}"; do
echo "Pulling model: $MODEL_NAME"
if ollama pull "$MODEL_NAME"; then
echo "Successfully pulled model: $MODEL_NAME"
else
echo "Failed to pull model: $MODEL_NAME"
kill $OLLAMA_PID
exit 1
fi
done
# Stop the Ollama server
echo "Stopping Ollama server..."