File size: 1,645 Bytes
40afe12
 
 
adf79f3
b2efd89
adf79f3
 
 
 
 
 
a3789d1
adf79f3
 
9ed86a1
adf79f3
 
 
a3789d1
adf79f3
 
6490764
adf79f3
 
 
 
 
 
6490764
adf79f3
 
 
 
 
 
 
 
 
40afe12
adf79f3
 
 
 
 
 
 
 
 
10dd1af
adf79f3
 
 
 
10dd1af
 
adf79f3
 
 
 
81d6e3d
596dacb
adf79f3
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash

# Default values
MODEL=${MODEL:-"microsoft/Phi-3-mini-4k-instruct"}
# MODEL=${MODEL:-"EleutherAI/pythia-70m"}
DTYPE=${DTYPE:-"half"}
MAX_NUM_BATCHED_TOKENS=${MAX_NUM_BATCHED_TOKENS:-512}
MAX_NUM_SEQS=${MAX_NUM_SEQS:-16}
GPU_MEMORY_UTILIZATION=${GPU_MEMORY_UTILIZATION:-0.85}
MAX_MODEL_LEN=${MAX_MODEL_LEN:-512}
ENFORCE_EAGER=${ENFORCE_EAGER:-true}

# Disable usage stats via environment variable
export VLLM_DISABLE_USAGE_STATS=true

# Print environment for debugging
echo "Environment variables:"
env

# Create and set permissions for the config directory
CONFIG_DIR=${XDG_CONFIG_HOME:-"/tmp/config"}

if [ ! -d "$CONFIG_DIR" ]; then
    mkdir -p "$CONFIG_DIR"
fi
chmod -R 777 "$CONFIG_DIR"
echo "Permissions for $CONFIG_DIR:"
ls -la "$CONFIG_DIR"

# Check and set permissions for directories
for dir in /tmp/huggingface /tmp/cache /tmp/numba_cache /tmp/outlines_cache /.config; do
    if [ ! -d "$dir" ]; then
        mkdir -p "$dir"
    fi
    chmod -R 777 "$dir"
    echo "Permissions for $dir:"
    ls -la "$dir"
done

# Construct the command
CMD="vllm serve $MODEL \
--host 0.0.0.0 \
--port 8000 \
--dtype $DTYPE \
--max-num-batched-tokens $MAX_NUM_BATCHED_TOKENS \
--max-num-seqs $MAX_NUM_SEQS \
--gpu-memory-utilization $GPU_MEMORY_UTILIZATION \
--max-model-len $MAX_MODEL_LEN"

# Add enforce-eager only if it's set to true
if [ "$ENFORCE_EAGER" = "true" ]; then
    CMD="$CMD --enforce-eager"
fi


# python3 -m vllm.entrypoints.openai.api_server \
#         --model EleutherAI/pythia-70m \
#         --gpu-memory-utilization 0.9 \
#         --max-model-len 200


# Execute the command
echo "Running command: $CMD"
exec $CMD