Let more then one model beeing pushed
This commit is contained in:
@@ -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..."
|
||||
|
||||
Reference in New Issue
Block a user