Skip to content

Commit d10800e

Browse files
fix: simplified the command to use the config directly
1 parent b095f93 commit d10800e

File tree

1 file changed

+17
-92
lines changed

1 file changed

+17
-92
lines changed

β€Žscripts/start_vllm.shβ€Ž

Lines changed: 17 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -2,103 +2,28 @@
22
set -e
33

44
# vLLM Server Startup Script
5-
# Usage: ./start_vllm.sh [config.yaml|model_path] [additional_args...]
5+
# Usage: ./start_vllm.sh config.yaml [additional_args...]
66

7-
show_usage() {
8-
echo "Usage: $0 [config.yaml|model_path] [additional_args...]"
7+
if [ $# -eq 0 ]; then
8+
echo "Usage: $0 config.yaml [additional_args...]"
99
echo ""
10-
echo "Examples:"
11-
echo " # Using YAML config file:"
10+
echo "Example:"
1211
echo " $0 vllm_config.yaml"
13-
echo ""
14-
echo " # Using model path with args:"
15-
echo " $0 ./outputs/lora-out --lora-modules lora_name=./outputs/lora-out"
16-
echo " $0 NousResearch/Llama-3.2-1B --max-model-len 4096"
17-
echo " $0 ./outputs/merged-model --port 8000"
18-
echo ""
19-
echo "YAML config example:"
20-
echo " model: ./outputs/my-model"
21-
echo " max_model_len: 32768"
22-
echo " gpu_memory_utilization: 0.95"
23-
echo " port: 8000"
24-
echo " host: 0.0.0.0"
25-
}
26-
27-
if [ $# -eq 0 ]; then
28-
show_usage
2912
exit 1
3013
fi
3114

32-
INPUT="$1"
33-
shift # Remove first arg, keep the rest
15+
CONFIG_FILE="$1"
16+
shift # Remove config file from args, keep additional args
3417

35-
# Check if input is a YAML file
36-
if [[ "$INPUT" == *.yaml ]] || [[ "$INPUT" == *.yml ]]; then
37-
if [ ! -f "$INPUT" ]; then
38-
echo "❌ Config file not found: $INPUT"
39-
exit 1
40-
fi
41-
42-
echo "πŸš€ Starting vLLM server with config file..."
43-
echo "πŸ“„ Config: $INPUT"
44-
45-
# Extract key info from YAML for display
46-
if command -v python3 >/dev/null 2>&1; then
47-
MODEL=$(python3 -c "
48-
import yaml
49-
try:
50-
with open('$INPUT', 'r') as f:
51-
config = yaml.safe_load(f)
52-
print(config.get('model', 'Not specified'))
53-
except:
54-
print('Could not parse config')
55-
" 2>/dev/null || echo "Could not parse config")
56-
57-
PORT=$(python3 -c "
58-
import yaml
59-
try:
60-
with open('$INPUT', 'r') as f:
61-
config = yaml.safe_load(f)
62-
print(config.get('port', 8000))
63-
except:
64-
print('8000')
65-
" 2>/dev/null || echo "8000")
66-
67-
HOST=$(python3 -c "
68-
import yaml
69-
try:
70-
with open('$INPUT', 'r') as f:
71-
config = yaml.safe_load(f)
72-
print(config.get('host', '0.0.0.0'))
73-
except:
74-
print('0.0.0.0')
75-
" 2>/dev/null || echo "0.0.0.0")
76-
77-
echo "πŸ“ Model: $MODEL"
78-
echo "🌐 Server will be available at: http://$HOST:$PORT"
79-
fi
80-
echo "πŸ”§ Additional args: $*"
81-
echo ""
82-
83-
# Start vLLM with config file (using dedicated venv)
84-
/opt/vllm-venv/bin/python -m vllm.entrypoints.openai.api_server \
85-
--config "$INPUT" \
86-
"$@"
87-
88-
else
89-
# Treat as model path (legacy mode)
90-
MODEL_PATH="$INPUT"
91-
92-
echo "πŸš€ Starting vLLM server..."
93-
echo "πŸ“ Model: $MODEL_PATH"
94-
echo "πŸ”§ Additional args: $*"
95-
echo "🌐 Server will be available at: http://0.0.0.0:8000"
96-
echo ""
97-
98-
# Start vLLM with the provided model and any additional arguments (using dedicated venv)
99-
/opt/vllm-venv/bin/python -m vllm.entrypoints.openai.api_server \
100-
--model "$MODEL_PATH" \
101-
--host 0.0.0.0 \
102-
--port 8000 \
103-
"$@"
18+
if [ ! -f "$CONFIG_FILE" ]; then
19+
echo "❌ Config file not found: $CONFIG_FILE"
20+
exit 1
10421
fi
22+
23+
echo "πŸš€ Starting vLLM server..."
24+
echo "πŸ“„ Config: $CONFIG_FILE"
25+
echo "πŸ”§ Additional args: $*"
26+
echo ""
27+
28+
# Start vLLM with config file (using dedicated venv)
29+
/opt/vllm-venv/bin/vllm serve --config "$CONFIG_FILE" "$@"

0 commit comments

Comments
Β (0)