Spaces:
Build error
Build error
Update entrypoint.sh
Browse files- entrypoint.sh +13 -8
entrypoint.sh
CHANGED
|
@@ -1,19 +1,24 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
# Starting server
|
| 4 |
echo "Starting server"
|
| 5 |
ollama serve &
|
| 6 |
-
sleep
|
| 7 |
|
| 8 |
-
# Splitting the models by comma and
|
| 9 |
IFS=',' read -ra MODELS <<< "$model"
|
| 10 |
for m in "${MODELS[@]}"; do
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
sleep 5
|
| 14 |
-
echo "Running $m"
|
| 15 |
-
ollama run "$m" --keepalive -1s
|
| 16 |
-
# No need to sleep here unless you want to give some delay between each pull for some reason
|
| 17 |
done
|
| 18 |
|
| 19 |
# Keep the script running to prevent the container from exiting
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
+
# Function to pull and run a model
|
| 4 |
+
pull_and_run_model() {
|
| 5 |
+
local model_name=$1
|
| 6 |
+
echo "Pulling $model_name"
|
| 7 |
+
ollama pull "$model_name"
|
| 8 |
+
echo "Running $model_name"
|
| 9 |
+
ollama run "$model_name" --keepalive -1s &
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
# Starting server
|
| 13 |
echo "Starting server"
|
| 14 |
ollama serve &
|
| 15 |
+
sleep 5 # Allowing time for the server to start
|
| 16 |
|
| 17 |
+
# Splitting the models by comma and processing each
|
| 18 |
IFS=',' read -ra MODELS <<< "$model"
|
| 19 |
for m in "${MODELS[@]}"; do
|
| 20 |
+
pull_and_run_model "$m"
|
| 21 |
+
sleep 5 # Optional: Delay between starting each model
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
done
|
| 23 |
|
| 24 |
# Keep the script running to prevent the container from exiting
|