-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Misc] Minimum requirements for SageMaker compatibility (#11576)
- Loading branch information
Showing
3 changed files
with
95 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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,24 @@ | ||
#!/bin/bash | ||
|
||
# Define the prefix for environment variables to look for | ||
PREFIX="SM_VLLM_" | ||
ARG_PREFIX="--" | ||
|
||
# Initialize an array for storing the arguments | ||
# port 8080 required by sagemaker, https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-inference-code.html#your-algorithms-inference-code-container-response | ||
ARGS=(--port 8080) | ||
|
||
# Loop through all environment variables | ||
while IFS='=' read -r key value; do | ||
# Remove the prefix from the key, convert to lowercase, and replace underscores with dashes | ||
arg_name=$(echo "${key#"${PREFIX}"}" | tr '[:upper:]' '[:lower:]' | tr '_' '-') | ||
|
||
# Add the argument name and value to the ARGS array | ||
ARGS+=("${ARG_PREFIX}${arg_name}") | ||
if [ -n "$value" ]; then | ||
ARGS+=("$value") | ||
fi | ||
done < <(env | grep "^${PREFIX}") | ||
|
||
# Pass the collected arguments to the main entrypoint | ||
exec python3 -m vllm.entrypoints.openai.api_server "${ARGS[@]}" |
This file contains 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