PolyText-Bench / deploy_textdart.sh
SujieHu's picture
Upload folder using huggingface_hub
3127b61 verified
Raw History Blame Contribute Delete
1.76 kB
#!/bin/bash
# Copyright 2026 Jayce-Ping
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy at http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations.
#
# Serve TextDART behind an OpenAI-compatible endpoint (ms-swift + vLLM).
#
# Usage:
# bash deploy_textdart.sh [MODEL] [PORT] [GPUS]
# MODEL Hugging Face repository or local path
# PORT Listening port (default: 1925)
# GPUS CUDA_VISIBLE_DEVICES list (default: 0,1,2,3,4,5,6,7)
set -euo pipefail
MODEL="${1:-SujieHu/TextDART-8B-Qwen3VL}"
PORT="${2:-1925}"
GPUS="${3:-0,1,2,3,4,5,6,7}"
GPU_MEM_UTILIZATION="${GPU_MEM_UTILIZATION:-0.85}"
MAX_NUM_SEQS="${MAX_NUM_SEQS:-256}"
IFS=',' read -r -a GPU_LIST <<< "${GPUS}"
DP_SIZE="${#GPU_LIST[@]}"
echo "Deploying ${MODEL} on port ${PORT} | GPUs ${GPUS} | data parallel ${DP_SIZE}"
exec env CUDA_VISIBLE_DEVICES="${GPUS}" \
IMAGE_MAX_TOKEN_NUM=2304 \
python -m swift.cli.deploy \
--model "${MODEL}" \
--use_hf true \
--model_type qwen3_vl \
--infer_backend vllm \
--vllm_gpu_memory_utilization "${GPU_MEM_UTILIZATION}" \
--vllm_tensor_parallel_size 1 \
--vllm_data_parallel_size "${DP_SIZE}" \
--vllm_max_num_seqs "${MAX_NUM_SEQS}" \
--vllm_max_model_len 32768 \
--vllm_limit_mm_per_prompt '{"image": 1}' \
--max_new_tokens 8192 \
--served_model_name TextDART \
--host 0.0.0.0 \
--port "${PORT}"