-
Notifications
You must be signed in to change notification settings - Fork 676
chore: mm epd disagg #4151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ayushag-nv
wants to merge
3
commits into
main
Choose a base branch
from
ayushag/multimodal-disagg
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+148
−78
Open
chore: mm epd disagg #4151
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| #!/bin/bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| set -e | ||
| trap 'echo Cleaning up...; kill 0' EXIT | ||
|
|
||
| # Default values | ||
| MODEL_NAME="llava-hf/llava-1.5-7b-hf" | ||
| PROMPT_TEMPLATE="USER: <image>\n<prompt> ASSISTANT:" | ||
| PROVIDED_PROMPT_TEMPLATE="" | ||
|
|
||
| # Parse command line arguments | ||
| while [[ $# -gt 0 ]]; do | ||
| case $1 in | ||
| --model) | ||
| MODEL_NAME=$2 | ||
| shift 2 | ||
| ;; | ||
| --prompt-template) | ||
| PROVIDED_PROMPT_TEMPLATE=$2 | ||
| shift 2 | ||
| ;; | ||
| -h|--help) | ||
| echo "Usage: $0 [OPTIONS]" | ||
| echo "" | ||
| echo "Disaggregated multimodal serving with separate Encode/Prefill/Decode workers" | ||
| echo "" | ||
| echo "Options:" | ||
| echo " --model <model_name> Specify the VLM model to use (default: $MODEL_NAME)" | ||
| echo " --prompt-template <template> Specify the multi-modal prompt template to use" | ||
| echo " LLaVA 1.5 7B, Qwen2.5-VL, and Phi3V models have predefined templates" | ||
| echo " -h, --help Show this help message" | ||
| echo "" | ||
| echo "Examples:" | ||
| echo " $0 --model llava-hf/llava-1.5-7b-hf" | ||
| echo " $0 --model microsoft/Phi-3.5-vision-instruct" | ||
| echo " $0 --model Qwen/Qwen2.5-VL-7B-Instruct" | ||
| echo "" | ||
| exit 0 | ||
| ;; | ||
| *) | ||
| echo "Unknown option: $1" | ||
| echo "Use --help for usage information" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| # Set PROMPT_TEMPLATE based on the MODEL_NAME | ||
| if [[ -n "$PROVIDED_PROMPT_TEMPLATE" ]]; then | ||
| PROMPT_TEMPLATE="$PROVIDED_PROMPT_TEMPLATE" | ||
| elif [[ "$MODEL_NAME" == "llava-hf/llava-1.5-7b-hf" ]]; then | ||
| PROMPT_TEMPLATE="USER: <image>\n<prompt> ASSISTANT:" | ||
| elif [[ "$MODEL_NAME" == "microsoft/Phi-3.5-vision-instruct" ]]; then | ||
| PROMPT_TEMPLATE="<|user|>\n<|image_1|>\n<prompt><|end|>\n<|assistant|>\n" | ||
| elif [[ "$MODEL_NAME" == "Qwen/Qwen2.5-VL-7B-Instruct" ]]; then | ||
| PROMPT_TEMPLATE="<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\n<|vision_start|><|image_pad|><|vision_end|><prompt><|im_end|>\n<|im_start|>assistant\n" | ||
| else | ||
| echo "No multi-modal prompt template is defined for the model: $MODEL_NAME" | ||
| echo "Please provide a prompt template using --prompt-template option." | ||
| echo "Example: --prompt-template 'USER: <image>\n<prompt> ASSISTANT:'" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "==================================================" | ||
| echo "Disaggregated Multimodal Serving" | ||
| echo "==================================================" | ||
| echo "Model: $MODEL_NAME" | ||
| echo "Prompt Template: $PROMPT_TEMPLATE" | ||
| echo "==================================================" | ||
|
|
||
| #export UCX_TLS=sm,self,tcp | ||
|
|
||
| echo "UCX Transport: $UCX_TLS (local same-machine mode)" | ||
| echo "==================================================" | ||
|
|
||
| # Start frontend (no router mode) | ||
| echo "Starting frontend..." | ||
| python -m dynamo.frontend --http-port=8000 & | ||
|
|
||
| # Start processor | ||
| echo "Starting processor..." | ||
| python -m dynamo.vllm --multimodal-processor --model $MODEL_NAME --mm-prompt-template "$PROMPT_TEMPLATE" & | ||
|
|
||
| # Configure GPU memory optimization for specific models | ||
| EXTRA_ARGS="" | ||
| if [[ "$MODEL_NAME" == "Qwen/Qwen2.5-VL-7B-Instruct" ]]; then | ||
| EXTRA_ARGS="--gpu-memory-utilization 0.85 --max-model-len 2048" | ||
| fi | ||
|
|
||
| # Start encode worker | ||
| echo "Starting encode worker on GPU 1..." | ||
| CUDA_VISIBLE_DEVICES=1 python -m dynamo.vllm --multimodal-encode-worker --model $MODEL_NAME $EXTRA_ARGS & | ||
|
|
||
| # Start prefill worker | ||
| echo "Starting prefill worker on GPU 2..." | ||
| CUDA_VISIBLE_DEVICES=2 python -m dynamo.vllm --multimodal-worker --is-prefill-worker --model $MODEL_NAME $EXTRA_ARGS & | ||
|
|
||
| # Start decode worker | ||
| echo "Starting decode worker on GPU 3..." | ||
| CUDA_VISIBLE_DEVICES=3 python -m dynamo.vllm --multimodal-decode-worker --model $MODEL_NAME $EXTRA_ARGS & | ||
|
|
||
| echo "==================================================" | ||
| echo "All components started. Waiting for initialization..." | ||
| echo "==================================================" | ||
|
|
||
| # Wait for all background processes to complete | ||
| wait | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.