start_server.sh 1.2 KB
Newer Older
helloyongyang's avatar
helloyongyang committed
1
2
#!/bin/bash

PengGao's avatar
PengGao committed
3
# Set paths
helloyongyang's avatar
helloyongyang committed
4
5
6
lightx2v_path=
model_path=

PengGao's avatar
PengGao committed
7
# Check parameters
helloyongyang's avatar
helloyongyang committed
8
9
if [ -z "${CUDA_VISIBLE_DEVICES}" ]; then
    cuda_devices=0
PengGao's avatar
PengGao committed
10
    echo "Warn: CUDA_VISIBLE_DEVICES is not set, using default value: ${cuda_devices}"
helloyongyang's avatar
helloyongyang committed
11
12
13
14
15
16
17
18
19
20
21
22
23
    export CUDA_VISIBLE_DEVICES=${cuda_devices}
fi

if [ -z "${lightx2v_path}" ]; then
    echo "Error: lightx2v_path is not set. Please set this variable first."
    exit 1
fi

if [ -z "${model_path}" ]; then
    echo "Error: model_path is not set. Please set this variable first."
    exit 1
fi

PengGao's avatar
PengGao committed
24
# Set environment variables
helloyongyang's avatar
helloyongyang committed
25
26
27
28
export TOKENIZERS_PARALLELISM=false
export PYTHONPATH=${lightx2v_path}:$PYTHONPATH
export ENABLE_PROFILING_DEBUG=true
export ENABLE_GRAPH_MODE=false
gushiqiao's avatar
gushiqiao committed
29
export DTYPE=BF16
helloyongyang's avatar
helloyongyang committed
30

PengGao's avatar
PengGao committed
31
32
33
34
35
36
37
38
echo "=========================================="
echo "Starting distributed inference API server"
echo "Model path: $model_path"
echo "CUDA devices: $CUDA_VISIBLE_DEVICES"
echo "API port: 8000"
echo "=========================================="

# Start API server with distributed inference service
helloyongyang's avatar
helloyongyang committed
39
40
python -m lightx2v.api_server \
--model_cls wan2.1 \
PengGao's avatar
PengGao committed
41
--task i2v \
helloyongyang's avatar
helloyongyang committed
42
--model_path $model_path \
PengGao's avatar
PengGao committed
43
44
45
46
47
--config_json ${lightx2v_path}/configs/wan/wan_i2v_dist.json \
--port 8000 \
--nproc_per_node 1

echo "Service stopped"