Skip to content

Commit

Permalink
Add vllm_worker related arguments in docker serving image's entrypoint (
Browse files Browse the repository at this point in the history
intel#9500)

* fix entrypoint

* fix missing long mode argument
  • Loading branch information
gc-fu authored Nov 21, 2023
1 parent 080a9da commit b234d7b
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions docker/llm/serving/cpu/docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

usage() {
echo "Usage: $0 [-m --mode <controller|worker>] [-h --help]"
echo "Usage: $0 [-m --mode <controller|worker>] [-h --help] [-w --worker <model_worker|vllm_worker>]"
echo "-h: Print help message."
echo "Controller mode reads the following env:"
echo "CONTROLLER_HOST (default: localhost)."
Expand Down Expand Up @@ -85,6 +85,7 @@ mode=""
omp_num_threads=""
dispatch_method="shortest_queue" # shortest_queue or lottery
stream_interval=1
worker_type="model_worker"

# Update rootCA config if needed
update-ca-certificates
Expand All @@ -101,7 +102,7 @@ if [ "$#" == 0 ]; then
exec /usr/bin/tini -s -- "bash"
else
# Parse command-line options
options=$(getopt -o "m:h" --long "mode:,help" -n "$0" -- "$@")
options=$(getopt -o "m:hw:" --long "mode:,help,worker:" -n "$0" -- "$@")
if [ $? != 0 ]; then
usage
fi
Expand All @@ -114,6 +115,11 @@ else
[[ $mode == "controller" || $mode == "worker" ]] || usage
shift 2
;;
-w|--worker)
worker_type="$2"
[[ $worker_type == "model_worker" || $worker_type == "vllm_worker" ]] || usage
shift 2
;;
-h|--help)
usage
;;
Expand All @@ -127,6 +133,12 @@ else
esac
done

if [ "$worker_type" == "model_worker" ]; then
worker_type="fastchat.serve.model_worker"
elif [ "$worker_type" == "vllm_worker" ]; then
worker_type="fastchat.serve.vllm_worker"
fi

if [[ -n $CONTROLLER_HOST ]]; then
controller_host=$CONTROLLER_HOST
fi
Expand Down Expand Up @@ -198,9 +210,10 @@ else
echo "Please set env MODEL_PATH used for worker"
usage
fi
echo "Worker type: $worker_type"
echo "Worker address: $worker_address"
echo "Controller address: $controller_address"
python3 -m fastchat.serve.model_worker --model-path $model_path --device cpu --host $worker_host --port $worker_port --worker-address $worker_address --controller-address $controller_address --stream-interval $stream_interval
python3 -m "$worker_type" --model-path $model_path --device cpu --host $worker_host --port $worker_port --worker-address $worker_address --controller-address $controller_address --stream-interval $stream_interval
fi
fi

Expand Down

0 comments on commit b234d7b

Please sign in to comment.