-
Notifications
You must be signed in to change notification settings - Fork 58
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
Sagemaker hosting container support #295
Conversation
…russ into sagemaker-hosting
RUN grep -w 'ID=debian\|ID_LIKE=debian' /etc/os-release || { echo "ERROR: Supplied base image is not a debian image"; exit 1; } | ||
RUN pythonVersion=$(echo $(command -v python >/dev/null 2>&1 && python --version || python3 --version) | cut -d" " -f2 | cut -d"." -f1,2) \ | ||
&& python -c "import sys; sys.exit(0) if sys.version_info.major == 3 and sys.version_info.minor >=8 and sys.version_info.minor <=11 else sys.exit(1)" \ | ||
&& (python -c "$PYVERSIONCHECK" || python3 -c "$PYVERSIONCHECK") \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was throwing an error on both the default GPU base image and my custom image, as both only have python3
available, not python
. I also noticed that the entrypoint below specifies python3
, so either that needs to also be dynamic or this serves no real purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment. I think @joostinyi put up a fix in a separate PR
Just took a cursory look and this is excellent. I remember you mentioning you might also have to mutate the headers. Is that still required? When you feel like it's ready, please request a review from @pankajroark Are there any docs we could add here on how to push this new image to sagemaker? We could also do this in a followup |
Not required, and to be useful it would need to pass the CustomAttributes header in to the user code and return a result header from it, so I think that's an item for a future followup. One of the primary uses of this header is to allow trace context propagation, which I think might be a useful PR on its own (the standard W3C headers could be supported through the normal endpoint).
There's nothing special required to run it - in a nutshell:
You can then create an endpoint config and deploy an endpoint, Features like async inference and batch transform should work out of the box too (though I haven't tested yet). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@palp This looks good to me overall. Let me kick off integration tests on this.
Running integration tests here: https://github.com/basetenlabs/truss/actions/runs/5060244484/jobs/9082853359 |
I've merged in latest from main which I think will resolve the test error. |
Running integration tests again here: https://github.com/basetenlabs/truss/actions/runs/5063344484 |
That test failure looks like test flakiness, rerunning. We'll fix the flaky test on our side separately. |
@palp Would you mind updating this file: |
Done! |
There's just a space mismatch in that test. For the sake of expedience, it's ok to land, I can fix the test quickly on master in a follow-up.
Or if you want to fix it, you can run the failing test locally like this: |
Whoops - fixed and tested locally, thanks. |
/ping
endpoint resolving to model readiness check. Since Sagemaker will start sending requests when this resolves to a 200, this needs to wait for the model to be ready to avoid serving errors. In a real-world test it seems SageMaker gives containers well over the claimed 4 minutes to start (10-15?) so I think this approach will work out./invocations
endpoint resolving to model inference. No contract changes are needed at this time, but the function is a wrapper so it could mutate the request.ENTRYPOINT
instead ofCMD
, as Sagemaker launches containers with theserve
argument which will override CMD. The argument is harmless withENTRYPOINT
specified.This is the bare minimum to function, I have tested a deployment and it works.