Spaces:
Paused
Paused
Download pull-model.sh from msradam/desirepath: direct link, hf CLI and curl.
- Browser
- Download file 778 Bytes
-
https://huggingface.co/spaces/msradam/desirepath/resolve/main/pull-model.sh
- Command line
-
hf download hf://spaces/msradam/desirepath/pull-model.sh
-
curl -L -o pull-model.sh https://huggingface.co/spaces/msradam/desirepath/resolve/main/pull-model.sh
778 Bytes
| # Bake the model into the image at build time. | |
| set -e | |
| mkdir -p "$OLLAMA_MODELS" | |
| ollama serve & | |
| SERVER_PID=$! | |
| i=0 | |
| until curl -sf http://127.0.0.1:11434/api/tags >/dev/null 2>&1; do | |
| i=$((i + 1)) | |
| if [ "$i" -gt 120 ]; then | |
| echo "ollama did not come up within 120s" | |
| exit 1 | |
| fi | |
| sleep 1 | |
| done | |
| ollama pull granite4:micro | |
| # Stop it by PID, not by pattern. | |
| # | |
| # `pkill -f "ollama serve"` matches this script's own command line inside the | |
| # Docker build, so it SIGTERMs the build step and the layer fails with exit | |
| # 143 immediately after a successful pull, which reads like the pull failed. | |
| kill "$SERVER_PID" 2>/dev/null || true | |
| wait "$SERVER_PID" 2>/dev/null || true | |
| # Give the manifest write a moment to flush before the layer is committed. | |
| sleep 2 | |
| exit 0 | |