-
Notifications
You must be signed in to change notification settings - Fork 29
LocalVLLMModel and deployment handler #102
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
70367a5
introduce LocalVLLMModel
540cbe9
improved functionality for vllm deployments
bb6f0b3
example script to deploy servers and run pipeline
5ed17e4
improved localvllm logic
4aa3a21
retrigger checks
e4f83a5
Merge branch 'mharrison/local-vllm-model' of https://github.com/micro…
714bde5
retrigger checks
f26a85e
removed unused import, better example model, more explicit error
574b72d
Merge branch 'main' into mharrison/local-vllm-model
839580c
added lock/dict to prevent multiple deployments of same model_name
efa8523
bad typo => useless lock
e58b84c
background threads need to be daemon, otherwise main thread never fin…
52509ba
The next commit will build on updates from concur branch.
a9e645d
inherit from EndpointModel, fix shutdown logic
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/bin/bash | ||
|
||
export PYTHONPATH="$(pwd):$PYTHONPATH" | ||
model_name="microsoft/phi-4" | ||
exp_config="IFEval_PIPELINE" | ||
current_datetime=$(date +"%Y-%m-%d-%H:%M:%S") | ||
log_dir="logs/deploy_vllm_and_run_eval/$current_datetime" | ||
mkdir -p $log_dir | ||
|
||
# vLLM args | ||
num_servers=4 | ||
tensor_parallel_size=1 | ||
pipeline_parallel_size=1 | ||
base_port=8000 | ||
gpus_per_port=$((tensor_parallel_size * pipeline_parallel_size)) | ||
|
||
# Add any additional args accepted by vLLM serve here | ||
VLLM_ARGS="\ | ||
--tensor-parallel-size=${tensor_parallel_size} \ | ||
--pipeline-parallel-size=${pipeline_parallel_size} \ | ||
--gpu-memory-utilization=0.9 \ | ||
" | ||
|
||
# Start servers | ||
echo "Spinning up servers..." | ||
for (( i = 0; i < $num_servers; i++ )) do | ||
port=$((base_port + i)) | ||
first_gpu=$((i * gpus_per_port)) | ||
last_gpu=$((first_gpu + gpus_per_port - 1)) | ||
devices=$(seq -s, $first_gpu $last_gpu) | ||
CUDA_VISIBLE_DEVICES=${devices} vllm serve ${model_name} "$@" --port ${port} ${VLLM_ARGS} >> $log_dir/${port}.log 2>&1 & | ||
done | ||
|
||
# Wait for servers to come online | ||
while true; do | ||
|
||
servers_online=0 | ||
for (( i = 0; i < $num_servers; i++ )) do | ||
port=$((base_port + i)) | ||
url="http://0.0.0.0:${port}/health" | ||
response=$(curl -s -o /dev/null -w "%{http_code}" "$url") | ||
|
||
if [ "$response" -eq 200 ]; then | ||
servers_online=$((servers_online + 1)) | ||
fi | ||
done | ||
|
||
if [ $servers_online -eq $num_servers ]; then | ||
echo "All servers are online." | ||
break | ||
else | ||
echo "Waiting for $((num_servers - servers_online)) more servers to come online..." | ||
fi | ||
|
||
sleep 10 | ||
done | ||
|
||
# Call Eureka to initiate evals | ||
ports=$(seq -s ' ' $base_port $((base_port + num_servers - 1))) | ||
EUREKA_ARGS="\ | ||
--model_config=${model_name} \ | ||
--exp_config=${exp_config} \ | ||
--local_vllm \ | ||
--ports ${ports} \ | ||
" | ||
echo "Starting evals..." | ||
python main.py ${EUREKA_ARGS} >> $log_dir/out.log 2>&1 | ||
|
||
# Shut down servers | ||
echo "Shutting down vLLM servers..." | ||
for (( i = 0; i < $num_servers; i++ )) do | ||
port=$((base_port + i)) | ||
logfile="$log_dir/${port}.log" | ||
pid=$(grep "Started server process" $logfile | grep -o '[0-9]\+') | ||
echo "Shutting down server on port ${port} (PID ${pid})" | ||
kill -INT $pid | ||
done |
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
michaelharrisonmai marked this conversation as resolved.
Show resolved
Hide resolved
|
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
Oops, something went wrong.
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.