Spaces:
Build error
Build error
Update entrypoint.sh
Browse files- entrypoint.sh +7 -9
entrypoint.sh
CHANGED
|
@@ -8,20 +8,20 @@ echo "=== System Information ==="
|
|
| 8 |
uname -a
|
| 9 |
nvidia-smi || echo "Warning: nvidia-smi failed, GPU may not be available"
|
| 10 |
|
| 11 |
-
# Start the text-generation-inference
|
| 12 |
echo "Starting text-generation-inference with model: ${MODEL_NAME}"
|
| 13 |
text-generation-launcher --model-id ${MODEL_NAME} --num-shard 1 --port 8080 --trust-remote-code &
|
| 14 |
TGI_PID=$!
|
| 15 |
echo "Text-generation-inference started with PID: $TGI_PID"
|
| 16 |
|
| 17 |
-
# Check if process is running
|
| 18 |
sleep 5
|
| 19 |
if ! kill -0 $TGI_PID 2>/dev/null; then
|
| 20 |
-
echo "ERROR: text-generation-inference process died!
|
| 21 |
exit 1
|
| 22 |
fi
|
| 23 |
|
| 24 |
-
# Wait for
|
| 25 |
echo "Waiting for text-generation-inference to be available..."
|
| 26 |
MAX_RETRIES=60
|
| 27 |
RETRY_COUNT=0
|
|
@@ -43,7 +43,7 @@ cd /app
|
|
| 43 |
dotenv -e /app/.env -c -- node /app/build/index.js -- --host 0.0.0.0 --port 3000 &
|
| 44 |
CHAT_UI_PID=$!
|
| 45 |
|
| 46 |
-
# Check if process is running
|
| 47 |
sleep 5
|
| 48 |
if ! kill -0 $CHAT_UI_PID 2>/dev/null; then
|
| 49 |
echo "ERROR: chat-ui process died!"
|
|
@@ -51,17 +51,15 @@ if ! kill -0 $CHAT_UI_PID 2>/dev/null; then
|
|
| 51 |
fi
|
| 52 |
|
| 53 |
echo "Chat UI is now available at http://0.0.0.0:3000"
|
| 54 |
-
echo "All services are
|
| 55 |
|
| 56 |
-
# Monitor
|
| 57 |
while true; do
|
| 58 |
-
# Check if TGI is still running
|
| 59 |
if ! kill -0 $TGI_PID 2>/dev/null; then
|
| 60 |
echo "ERROR: text-generation-inference process died!"
|
| 61 |
exit 1
|
| 62 |
fi
|
| 63 |
|
| 64 |
-
# Check if Chat-UI is still running
|
| 65 |
if ! kill -0 $CHAT_UI_PID 2>/dev/null; then
|
| 66 |
echo "ERROR: chat-ui process died!"
|
| 67 |
exit 1
|
|
|
|
| 8 |
uname -a
|
| 9 |
nvidia-smi || echo "Warning: nvidia-smi failed, GPU may not be available"
|
| 10 |
|
| 11 |
+
# Start the text-generation-inference server
|
| 12 |
echo "Starting text-generation-inference with model: ${MODEL_NAME}"
|
| 13 |
text-generation-launcher --model-id ${MODEL_NAME} --num-shard 1 --port 8080 --trust-remote-code &
|
| 14 |
TGI_PID=$!
|
| 15 |
echo "Text-generation-inference started with PID: $TGI_PID"
|
| 16 |
|
| 17 |
+
# Check if TGI process is running
|
| 18 |
sleep 5
|
| 19 |
if ! kill -0 $TGI_PID 2>/dev/null; then
|
| 20 |
+
echo "ERROR: text-generation-inference process died!"
|
| 21 |
exit 1
|
| 22 |
fi
|
| 23 |
|
| 24 |
+
# Wait for TGI to be available
|
| 25 |
echo "Waiting for text-generation-inference to be available..."
|
| 26 |
MAX_RETRIES=60
|
| 27 |
RETRY_COUNT=0
|
|
|
|
| 43 |
dotenv -e /app/.env -c -- node /app/build/index.js -- --host 0.0.0.0 --port 3000 &
|
| 44 |
CHAT_UI_PID=$!
|
| 45 |
|
| 46 |
+
# Check if Chat UI process is running
|
| 47 |
sleep 5
|
| 48 |
if ! kill -0 $CHAT_UI_PID 2>/dev/null; then
|
| 49 |
echo "ERROR: chat-ui process died!"
|
|
|
|
| 51 |
fi
|
| 52 |
|
| 53 |
echo "Chat UI is now available at http://0.0.0.0:3000"
|
| 54 |
+
echo "All services are running"
|
| 55 |
|
| 56 |
+
# Monitor processes and keep container running
|
| 57 |
while true; do
|
|
|
|
| 58 |
if ! kill -0 $TGI_PID 2>/dev/null; then
|
| 59 |
echo "ERROR: text-generation-inference process died!"
|
| 60 |
exit 1
|
| 61 |
fi
|
| 62 |
|
|
|
|
| 63 |
if ! kill -0 $CHAT_UI_PID 2>/dev/null; then
|
| 64 |
echo "ERROR: chat-ui process died!"
|
| 65 |
exit 1
|