Fix port collision: scope PORT env to llama.cpp subprocess
Browse files- entrypoint.sh +4 -1
entrypoint.sh
CHANGED
|
@@ -11,7 +11,10 @@ CTX="${PHANTOM_GRID_LLAMACPP_CONTEXT_LENGTH:-8192}"
|
|
| 11 |
APP_PORT="${PORT:-7860}"
|
| 12 |
|
| 13 |
echo "[entrypoint] Starting llama.cpp server on :${LLAMA_PORT} with ${MODEL_PATH}"
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
--model "${MODEL_PATH}" \
|
| 16 |
--host 127.0.0.1 \
|
| 17 |
--port "${LLAMA_PORT}" \
|
|
|
|
| 11 |
APP_PORT="${PORT:-7860}"
|
| 12 |
|
| 13 |
echo "[entrypoint] Starting llama.cpp server on :${LLAMA_PORT} with ${MODEL_PATH}"
|
| 14 |
+
# llama_cpp.server's pydantic Settings reads HOST/PORT from env and they
|
| 15 |
+
# override the CLI flags — so on HF Spaces (PORT=7860) the server would bind
|
| 16 |
+
# 7860 and collide with Gradio. Scope HOST/PORT to just this subprocess.
|
| 17 |
+
HOST=127.0.0.1 PORT="${LLAMA_PORT}" python -m llama_cpp.server \
|
| 18 |
--model "${MODEL_PATH}" \
|
| 19 |
--host 127.0.0.1 \
|
| 20 |
--port "${LLAMA_PORT}" \
|