Skip to content

Commit c5c2cb4

Browse files
committed
Support running VL models with trtllm-launcher.sh
1 parent 16d4eab commit c5c2cb4

1 file changed

Lines changed: 29 additions & 15 deletions

File tree

src/launchers/trtllm-launcher.sh

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ parse_serving_config() {
120120
ep_size=${SERVING_CONFIG_DICT["ep_size"]:=1}
121121
backend=${SERVING_CONFIG_DICT["backend"]:="tensorrt"}
122122
kv_cache_free_gpu_mem_fraction=${SERVING_CONFIG_DICT["kv_cache_free_gpu_mem_fraction"]:=0.95}
123+
modality=${SERVING_CONFIG_DICT["modality"]:=""}
124+
streaming=${SERVING_CONFIG_DICT["streaming"]:="false"}
125+
max_input_len=${SERVING_CONFIG_DICT["max_input_len"]:=""}
126+
max_batch_size=${SERVING_CONFIG_DICT["max_batch_size"]:=""}
127+
custom_dataset=${SERVING_CONFIG_DICT["dataset"]:=""}
123128
}
124129

125130
print_configuration() {
@@ -158,26 +163,34 @@ run_benchmark() {
158163
local backend=$8
159164
local kv_cache_free_gpu_mem_fraction=$9
160165

161-
echo "Running benchmark for $model_name with ISL=$isl, OSL=$osl, TP=$tp_size, PP=$pp_size, EP=$ep_size, backend=$7"
166+
echo "Running benchmark for $model_name with ISL=$isl, OSL=$osl, TP=$tp_size, PP=$pp_size, EP=$ep_size, backend=$backend"
162167

163-
dataset_file="/ssd/token-norm-dist_${model_name##*/}_${isl}_${osl}_tp${tp_size}.json" # Add $psl
164-
output_file="/ssd/output_${model_name##*/}_isl${isl}_osl${osl}_tp${tp_size}.txt" # Add $psl
168+
vl_args=""
169+
if [ -n "$modality" ]; then vl_args="$vl_args --modality $modality"; fi
170+
if [ "$streaming" == "true" ]; then vl_args="$vl_args --streaming"; fi
171+
if [ -n "$max_input_len" ]; then vl_args="$vl_args --max_input_len $max_input_len"; fi
172+
if [ -n "$max_batch_size" ]; then vl_args="$vl_args --max_batch_size $max_batch_size"; fi
173+
174+
dataset_file=$custom_dataset
175+
if [ -z "$dataset_file" ]; then
176+
dataset_file="/ssd/token-norm-dist_${model_name##*/}_${isl}_${osl}_tp${tp_size}.json"
177+
echo "Preparing dataset"
178+
python3 $TRTLLM_DIR/benchmarks/cpp/prepare_dataset.py \
179+
--tokenizer=$model_name \
180+
--stdout token-norm-dist \
181+
--num-requests=$num_requests \
182+
--input-mean=$isl \
183+
--output-mean=$osl \
184+
--input-stdev=0 \
185+
--output-stdev=0 >$dataset_file
186+
fi
187+
188+
output_file="/ssd/output_${model_name##*/}_isl${isl}_osl${osl}_tp${tp_size}.txt"
165189
extra_args_file="/tmp/extra_llm_api_args.yaml"
166190
extra_args=""
167191
if [ -f "$extra_args_file" ]; then
168192
extra_args="--extra_llm_api_options $extra_args_file"
169193
fi
170-
171-
echo "Preparing dataset"
172-
python3 $TRTLLM_DIR/benchmarks/cpp/prepare_dataset.py \
173-
--tokenizer=$model_name \
174-
--stdout token-norm-dist \
175-
--num-requests=$num_requests \
176-
--input-mean=$isl \
177-
--output-mean=$osl \
178-
--input-stdev=0 \
179-
--output-stdev=0 >$dataset_file
180-
# --prefix-mean=$psl \
181194

182195
export TOKENIZERS_PARALLELISM=false
183196
echo "enable_cuda_graph: false" > /tmp/extra_llm_api_args.yaml
@@ -193,7 +206,8 @@ run_benchmark() {
193206
--pp $pp_size \
194207
--ep $ep_size \
195208
--backend "pytorch" \
196-
--kv_cache_free_gpu_mem_fraction $kv_cache_free_gpu_mem_fraction $extra_args >$output_file
209+
--kv_cache_free_gpu_mem_fraction $kv_cache_free_gpu_mem_fraction \
210+
$extra_args $vl_args > $output_file
197211
else
198212
echo "Building engine"
199213
trtllm-bench \

0 commit comments

Comments
 (0)