Skip to content

Commit 923c916

Browse files
committed
fix qwen 2.5 vl
1 parent dd0bed2 commit 923c916

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

examples/llm_ptq/example_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def get_tokenizer(ckpt_path, trust_remote_code=False, **kwargs):
6464
ckpt_path, trust_remote_code=trust_remote_code, **kwargs
6565
)
6666

67-
if "qwen" in type(tokenizer).__name__.lower():
67+
if "qwen" in type(tokenizer).__name__.lower() and 'vl' not in ckpt_path.lower():
6868
# qwen use token id 151643 as pad and eos tokens
6969
tokenizer.pad_token = tokenizer.convert_ids_to_tokens(151643)
7070
tokenizer.eos_token = tokenizer.convert_ids_to_tokens(151643)

examples/vlm_ptq/scripts/huggingface_example.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ for i in $(env | grep ^PMI_ | cut -d"=" -f 1); do unset -v $i; done
3030
for i in $(env | grep ^PMIX_ | cut -d"=" -f 1); do unset -v $i; done
3131

3232
case $MODEL_TYPE in
33-
llava|phi|vila|mllama)
33+
llava|phi|vila|mllama|qwen)
3434
;;
3535
*)
36-
echo "Unsupported type argument: Expected one of: [llava, phi, vila, mllama]" >&2
36+
echo "Unsupported type argument: Expected one of: [llava, phi, vila, mllama, qwen]" >&2
3737
exit 1
3838
esac
3939

@@ -91,7 +91,7 @@ fi
9191

9292
BUILD_MAX_OUTPUT_LEN=512
9393

94-
if [ "$MODEL_TYPE" = "llava" ] || [ "$MODEL_TYPE" = "vila" ]; then
94+
if [ "$MODEL_TYPE" = "llava" ] || [ "$MODEL_TYPE" = "vila" ] || [ "$MODEL_TYPE" = "qwen" ]; then
9595
BUILD_MAX_BATCH_SIZE=20
9696
else
9797
BUILD_MAX_BATCH_SIZE=4
@@ -145,6 +145,10 @@ case "${MODEL_TYPE}" in
145145
VISUAL_FEATURE=576
146146
VLM_ARGS=" --max_multimodal_len=$((BUILD_MAX_BATCH_SIZE * VISUAL_FEATURE)) "
147147
;;
148+
"qwen")
149+
VISUAL_FEATURE=1280
150+
VLM_ARGS=" --max_multimodal_len=$((BUILD_MAX_BATCH_SIZE * VISUAL_FEATURE)) "
151+
;;
148152
"mllama")
149153
PTQ_ARGS+=" --kv_cache_qformat none "
150154
VLM_ARGS=" --max_encoder_input_len=6404 --skip_run"
@@ -182,6 +186,10 @@ if [[ $TASKS =~ "build" ]] || [[ ! -d "$ENGINE_DIR" ]] || [[ ! $(ls -A $ENGINE_D
182186
echo "Quantized model config $MODEL_CONFIG exists, skipping the quantization stage"
183187
fi
184188

189+
if [ "${MODEL_TYPE}" = "qwen" ]; then
190+
cp ${MODEL_PATH}/preprocessor_config.json ${SAVE_PATH}
191+
fi
192+
185193
if [ $EXPORT_FORMAT != "tensorrt_llm" ]; then
186194
echo "Please continue deployment with $EXPORT_FORMAT. Checkpoint export_path: $SAVE_PATH"
187195
exit 0

0 commit comments

Comments
 (0)