clip_embedding/start.sh

24 lines
643 B
Bash
Executable File

#!/bin/bash
cd "$(dirname "$0")"
export CLIP_GPU_ID="${CLIP_GPU_ID:-2}"
export CUDA_VISIBLE_DEVICES="$CLIP_GPU_ID"
export PYTHONPATH="$(pwd)"
if [ -f ah.pid ] && kill -0 $(cat ah.pid) 2>/dev/null; then
echo "Service already running (PID $(cat ah.pid))"
exit 1
fi
echo "Starting CLIP Embedding Service on GPU $CLIP_GPU_ID, port 9086..."
nohup /data/ymq/wan22-service/py3/bin/python ah.py > nohup.out 2>&1 &
echo $! > ah.pid
echo "Started (PID $(cat ah.pid))"
sleep 2
if kill -0 $(cat ah.pid) 2>/dev/null; then
echo "Service is running"
else
echo "Service failed to start. Check nohup.out"
tail -20 nohup.out
exit 1
fi