diff --git a/scripts/run_assistant_server.sh b/scripts/run_assistant_server.sh index fa41d0990..e1d76ef00 100644 --- a/scripts/run_assistant_server.sh +++ b/scripts/run_assistant_server.sh @@ -9,6 +9,9 @@ MODEL_DIR="" MODEL_SERVER="" MODEL_NAME="" +# Save all command line arguments +ALL_ARGS="$@" + # Loop through arguments and process them while [[ $# -gt 0 ]]; do case $1 in @@ -38,7 +41,6 @@ echo "Model name: $MODEL_NAME" echo "Model directory: $MODEL_DIR" echo "Model server: $MODEL_SERVER" - # running echo "Running fastapi assistant server at port 31512." export PYTHONPATH=$PYTHONPATH:modelscope_agent_servers @@ -46,7 +48,7 @@ export PYTHONPATH=$PYTHONPATH:modelscope_agent_servers if [ "$MODEL_DIR" != "" ]; then echo "Running vllm server, please make sure install vllm" # Start the first server in the background on port 8000 - python -m vllm.entrypoints.openai.api_server --served-model-name $MODEL_NAME --model $MODEL_DIR & SERVER_1_PID=$! + python -m vllm.entrypoints.openai.api_server $ALL_ARGS & SERVER_1_PID=$! export MODEL_SERVER=vllm-server export OPENAI_API_BASE=http://localhost:8000/v1 echo "Model server: $MODEL_SERVER" @@ -55,7 +57,7 @@ if [ "$MODEL_DIR" != "" ]; then # Function to check if the first server is up check_first_server() { echo "Checking if Server 1 is up..." - for i in {1..10}; do # try up to 10 times + for i in {1..100000000}; do # try up to 100000000 times curl -s http://localhost:8000 > /dev/null if [ $? -eq 0 ]; then echo "Server 1 is up and running." @@ -70,9 +72,9 @@ if [ "$MODEL_DIR" != "" ]; then # Wait for the first server to be up if check_first_server; then - # Start the second server on port 8001 + # Start the second server on port 31512 echo "Starting Server 2..." - uvicorn modelscope_agent_servers.assistant_server.api:app --host 0.0.0.0 --port 31512 & $SERVER_2_PID + uvicorn modelscope_agent_servers.assistant_server.api:app --host 0.0.0.0 --port 31512 & SERVER_2_PID=$! else echo "Failed to start Server 1." exit 1