2025-11-17 14:44:10 +08:00
#!/usr/bin/env bash
set -euo pipefail
2025-11-24 16:02:44 +08:00
# Default query type
2025-11-30 21:30:17 +08:00
QUERY_TYPE = " ${ 1 :- use_video } "
2025-11-24 16:02:44 +08:00
2025-12-17 17:19:56 +08:00
# Default modalities argument
MODALITIES = " ${ 2 :- null } "
2025-11-24 16:02:44 +08:00
# Validate query type
2025-11-30 21:30:17 +08:00
if [[ ! " $QUERY_TYPE " = ~ ^( text| use_audio| use_image| use_video) $ ]] ; then
2025-11-24 16:02:44 +08:00
echo "Error: Invalid query type ' $QUERY_TYPE '"
2025-12-17 17:19:56 +08:00
echo "Usage: $0 [text|use_audio|use_image|use_video] [modalities]"
2025-11-24 16:02:44 +08:00
echo " text: Text query"
2025-11-30 21:30:17 +08:00
echo " use_audio: Audio + Text query"
echo " use_image: Image + Text query"
echo " use_video: Video + Text query"
2025-12-17 17:19:56 +08:00
echo " modalities: Modalities parameter (default: null)"
2025-11-24 16:02:44 +08:00
exit 1
fi
2025-11-17 14:44:10 +08:00
SEED = 42
thinker_sampling_params = '{
2025-11-30 04:44:01 +08:00
"temperature": 0.4,
"top_p": 0.9,
"top_k": 1,
"max_tokens": 16384,
2025-11-17 14:44:10 +08:00
"seed": 42,
2025-11-30 04:44:01 +08:00
"repetition_penalty": 1.05,
"stop_token_ids": [151645]
2025-11-17 14:44:10 +08:00
}'
talker_sampling_params = '{
"temperature": 0.9,
2025-11-30 04:44:01 +08:00
"top_k": 50,
"max_tokens": 4096,
2025-11-17 14:44:10 +08:00
"seed": 42,
2025-11-30 21:30:17 +08:00
"detokenize": false,
2025-11-17 14:44:10 +08:00
"repetition_penalty": 1.05,
2025-11-30 04:44:01 +08:00
"stop_token_ids": [2150]
2025-11-17 14:44:10 +08:00
}'
code2wav_sampling_params = '{
"temperature": 0.0,
"top_p": 1.0,
"top_k": -1,
2025-12-01 16:01:54 +08:00
"max_tokens": 65536,
2025-11-17 14:44:10 +08:00
"seed": 42,
"detokenize": true,
"repetition_penalty": 1.1
}'
2026-08-20 07:09:12 +08:00
# The block above is optional; defaults come from the resolved pipeline and deploy config.
2025-11-17 14:44:10 +08:00
2025-11-24 16:02:44 +08:00
# Define URLs for assets
MARY_HAD_LAMB_AUDIO_URL = "https://vllm-public-assets.s3.us-west-2.amazonaws.com/multimodal_asset/mary_had_lamb.ogg"
CHERRY_BLOSSOM_IMAGE_URL = "https://vllm-public-assets.s3.us-west-2.amazonaws.com/vision_model_images/cherry_blossom.jpg"
SAMPLE_VIDEO_URL = "https://huggingface.co/datasets/raushan-testing-hf/videos-test/resolve/main/sample_demo_1.mp4"
# Build user content and extra fields based on query type
case " $QUERY_TYPE " in
text)
user_content = '[
{
"type": "text",
"text": "Explain the system architecture for a scalable audio generation pipeline. Answer in 15 words."
}
]'
sampling_params_list = '[
' " $thinker_sampling_params " ',
' " $talker_sampling_params " ',
' " $code2wav_sampling_params " '
]'
mm_processor_kwargs = "{}"
;;
2025-11-30 21:30:17 +08:00
use_audio)
2025-11-24 16:02:44 +08:00
user_content = '[
{
"type": "audio_url",
"audio_url": {
"url": "' " $MARY_HAD_LAMB_AUDIO_URL " '"
}
},
{
"type": "text",
2025-11-30 21:30:17 +08:00
"text": "What is the content of this audio?"
2025-11-24 16:02:44 +08:00
}
]'
sampling_params_list = '[
' " $thinker_sampling_params " ',
' " $talker_sampling_params " ',
' " $code2wav_sampling_params " '
]'
mm_processor_kwargs = "{}"
;;
2025-11-30 21:30:17 +08:00
use_image)
user_content = '[
{
"type": "image_url",
"image_url": {
"url": "' " $CHERRY_BLOSSOM_IMAGE_URL " '"
}
},
{
"type": "text",
"text": "What is the content of this image?"
}
]'
sampling_params_list = '[
' " $thinker_sampling_params " ',
' " $talker_sampling_params " ',
' " $code2wav_sampling_params " '
]'
mm_processor_kwargs = "{}"
;;
use_video)
2025-11-24 16:02:44 +08:00
user_content = '[
{
"type": "video_url",
"video_url": {
"url": "' " $SAMPLE_VIDEO_URL " '"
}
},
{
"type": "text",
2025-11-30 21:30:17 +08:00
"text": "Why is this video funny?"
2025-11-24 16:02:44 +08:00
}
]'
sampling_params_list = '[
' " $thinker_sampling_params " ',
' " $talker_sampling_params " ',
' " $code2wav_sampling_params " '
]'
mm_processor_kwargs = "{}"
;;
esac
echo "Running query type: $QUERY_TYPE "
echo ""
2026-03-03 11:56:42 +08:00
request_body = $( cat <<EOF
2025-11-17 14:44:10 +08:00
{
2025-11-30 21:30:17 +08:00
"model": "Qwen/Qwen3-Omni-30B-A3B-Instruct",
2025-11-24 16:02:44 +08:00
"sampling_params_list": $sampling_params_list,
"mm_processor_kwargs": $mm_processor_kwargs,
2025-12-17 17:19:56 +08:00
"modalities": $MODALITIES,
2025-11-17 14:44:10 +08:00
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "You are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, capable of perceiving auditory and visual inputs, as well as generating text and speech."
}
]
},
{
"role": "user",
2025-11-24 16:02:44 +08:00
"content": $user_content
2025-11-17 14:44:10 +08:00
}
]
}
EOF
2026-03-03 11:56:42 +08:00
)
output = $( curl -sS --retry 3 --retry-delay 3 --retry-connrefused \
-X POST http://localhost:8091/v1/chat/completions \
-H "Content-Type: application/json" \
-d " $request_body " )
2025-11-17 14:44:10 +08:00
# Here it only shows the text content of the first choice. Audio content has many binaries, so it's not displayed here.
echo "Output of request: $( echo " $output " | jq '.choices[0].message.content' ) "