Add SageMaker hosting entrypoint to vLLM Neuron DLC 0.24.0.1.1.0 - #208
Open
malav-shastri wants to merge 1 commit into
Open
malav-shastri wants to merge 1 commit into
malav-shastri wants to merge 1 commit into
Conversation
SageMaker launches an inference container as `docker run <image> serve`,
appending `serve` as an argument and overriding CMD. The current ENTRYPOINT
(common/vllm_entrypoint.py) execs its argv verbatim, so `serve` is treated as a
command to execute and the container exits immediately:
$ docker run --rm \
public.ecr.aws/neuron/pytorch-inference-vllm-neuronx:0.24.0.1.1.0-neuronx-py313-sdk2.32.0-ubuntu24.04 \
serve
FileNotFoundError: [Errno 2] No such file or directory: 'serve'
This adds an executable named `serve` on PATH rather than changing ENTRYPOINT,
so the passthrough entrypoint resolves it while existing EC2/Kubernetes usage
(`docker run <image> vllm serve ...`) keeps working unchanged.
common/serve and common/sagemaker_args.py are adapted from
aws/deep-learning-containers scripts/docker/vllm/ (Apache-2.0). Two pieces of
the GPU original are dropped: bash_telemetry.sh (not present in this image) and
the SageMakerRouteMiddleware flag (unnecessary, since vLLM >= 0.24 registers
/ping and /invocations natively via
vllm.entrypoints.serve.sagemaker.api_router). standard-supervisor is already
available from the model_hosting_container_standards package this image installs.
malav-shastri
marked this pull request as ready for review
September 21, 2026 13:07
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The published image can't be used as an Amazon SageMaker inference container. SageMaker launches one as
docker run <image> serve, appendingserveas an argument and overridingCMD. The currentENTRYPOINT(common/vllm_entrypoint.py) is a passthrough that execs its argv verbatim:so
serveis interpreted as a command to run, and there is no such executable in the image:The container exits immediately, so
CreateEndpointfails at launch. (Digest above is the current0.24.0.1.1.0-neuronx-py313-sdk2.32.0-ubuntu24.04tag, built 2026-08-18.)To be clear, this isn't a defect — the passthrough is the right design for EC2/Kubernetes, where the caller supplies the command. It's a mismatch with SageMaker's convention of passing the mode as
argv[1].Everything else SageMaker needs is already here
Config.Userempty)HEALTHCHECKalready hits/ping/opt/ml/modelcreated/pingand/invocationsnatively viavllm/entrypoints/serve/sagemaker/api_router.py, called unconditionally fromapi_server.pymodel_hosting_container_standards0.1.16 is installed, sostandard-supervisoris on PATH at/opt/conda/bin/standard-supervisorSo only the process-launch step is missing.
Approach: add
serverather than changeENTRYPOINTBecause the entrypoint execs its argv, simply providing an executable named
serveon PATH is enough. This means:docker run <image> serve→ SageMaker worksdocker run <image> vllm serve ...→ existing EC2/k8s usage unchangedNo
ENTRYPOINTchange, no new build stage, no behavior change for current users.Changes
common/sagemaker_args.pySM_VLLM_*env vars into vLLM CLI argscommon/servestandard-supervisorvllm/inference/0.24.0.1.1.0/Dockerfile.neuronx/usr/local/bin(+6 lines)Both files are adapted from
aws/deep-learning-containersscripts/docker/vllm/(Apache-2.0, same license as this repo), which is what the GPU SageMaker DLC uses. Two pieces of the GPU original are intentionally dropped:bash_telemetry.sh— not present in this image--middleware sagemaker_serve.SageMakerRouteMiddleware— unnecessary, since vLLM >= 0.24 registers the SageMaker routes nativelyVerification
Built locally on top of the published image. Before:
After, with
SM_VLLM_MODEL=openai/gpt-oss-20b SM_VLLM_TENSOR_PARALLEL_SIZE=8 SM_VLLM_MAX_MODEL_LEN=8192:The env-to-CLI translation, supervisor launch, and server startup all succeed. The final error is the test host having no Trainium devices (
vllm_neuron: No Neuron devices found. Skipping Neuron plugin registration), not a problem with the change. I have not yet run this on a trn2 instance — if someone on your side can, that would confirm the server comes up and serves/invocationsend to end.Two related notes, not in this diff
dlc_major_version,maintainer, andorg.opencontainers.image.version. The GPU SageMaker DLC carries the fullcom.amazonaws.ml.engines.sagemaker.dlc.*taxonomy (device.gpu.cu130,framework.vllm.0-29-0,python.py312,os.ubuntu24-04,arch.x86). Downstream tooling reads those to identify a DLC and its accelerator, and there's no Neuron device label today.huggingface-vllm-inference-neuronxis already in763104351884across 11 regions, so the path exists — is putting the plugin line on it planned?Context: evaluating this image for AWS Trainium support in Amazon SageMaker JumpStart, with
openai/gpt-oss-20bas the pilot model.