Download faisi/src/runner/serve_models.sh from ppJustin/micro: direct link, hf CLI and curl.
- Browser
- Download file 1.77 kB
-
https://huggingface.co/datasets/ppJustin/micro/resolve/main/faisi/src/runner/serve_models.sh
- Command line
-
hf download hf://datasets/ppJustin/micro/faisi/src/runner/serve_models.sh
-
curl -L -o serve_models.sh https://huggingface.co/datasets/ppJustin/micro/resolve/main/faisi/src/runner/serve_models.sh
1.77 kB
| set -euo pipefail | |
| : "${FAISI_VENV:?Set FAISI_VENV to the W1-01 environment}" | |
| : "${WORK_ROOT:?Set WORK_ROOT to the project root}" | |
| : "${W104_LOG_DIR:?Set W104_LOG_DIR to the local service log directory}" | |
| mkdir -p "$W104_LOG_DIR" | |
| export HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 HF_DATASETS_OFFLINE=1 VLLM_USE_MODELSCOPE=false | |
| export CUDA_DEVICE_ORDER=PCI_BUS_ID OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 TOKENIZERS_PARALLELISM=false | |
| include="$FAISI_VENV/include/python3.10" | |
| if [[ -r "$include/Python.h" ]]; then | |
| export C_INCLUDE_PATH="$include${C_INCLUDE_PATH:+:$C_INCLUDE_PATH}" | |
| export CPLUS_INCLUDE_PATH="$include${CPLUS_INCLUDE_PATH:+:$CPLUS_INCLUDE_PATH}" | |
| fi | |
| start_model() { | |
| local model=$1 devices=$2 port=$3 | |
| CUDA_VISIBLE_DEVICES="$devices" "$FAISI_VENV/bin/python" -m vllm.entrypoints.openai.api_server \ | |
| --host 127.0.0.1 --port "$port" --model "$WORK_ROOT/models/$model" \ | |
| --served-model-name "$model" --tensor-parallel-size 4 --distributed-executor-backend mp \ | |
| --dtype bfloat16 --generation-config vllm --max-model-len 16384 \ | |
| --max-num-seqs 128 --max-num-batched-tokens 16384 --gpu-memory-utilization 0.88 \ | |
| --enable-prefix-caching --enable-auto-tool-choice --tool-call-parser hermes \ | |
| --structured-outputs-config '{"backend":"xgrammar","disable_any_whitespace":true}' \ | |
| --disable-uvicorn-access-log > "$W104_LOG_DIR/$model.log" 2>&1 & | |
| } | |
| start_model Qwen2.5-7B-Instruct 0,1,2,3 "${W104_PORT_7B:-19071}" | |
| pid_7=$! | |
| start_model Qwen2.5-14B-Instruct 4,5,6,7 "${W104_PORT_14B:-19072}" | |
| pid_14=$! | |
| cleanup() { | |
| kill -TERM "$pid_7" "$pid_14" 2>/dev/null || true | |
| wait "$pid_7" "$pid_14" 2>/dev/null || true | |
| } | |
| trap cleanup EXIT | |
| trap 'exit 130' INT TERM | |
| wait -n "$pid_7" "$pid_14" | |