-
Notifications
You must be signed in to change notification settings - Fork 295
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
Adds a Default ImageSpec image builder #2346
Adds a Default ImageSpec image builder #2346
Conversation
Signed-off-by: Thomas J. Fan <[email protected]>
Signed-off-by: Thomas J. Fan <[email protected]>
Signed-off-by: Thomas J. Fan <[email protected]>
Signed-off-by: Thomas J. Fan <[email protected]>
Signed-off-by: Thomas J. Fan <[email protected]>
base_image = image_spec.base_image or "debian:bookworm-slim" | ||
|
||
if image_spec.cuda: | ||
# Base image requires an NVIDIA driver. cuda and cudnn will be installed with conda |
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.
The semantics here are not great. If we install cuda
with conda
and then install pytorch through pypi
, then cuda
will be installed twice.
- PyTorch through pypi will pull in cuda from PyPI
- Using conda to install cuda adds a second one
We can add more logic to do: If cuda
is set:
- Install pypi packages
- Check if cuda is installed
- If pypi's cuda is not installed, get it from it from conda (or pypi)
- If pypi's cuda is installed, do nothing.
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.
Agree, should we deprecate cuda
, cudnn
?
Thus, if people want to use cuda, they do
ImageSpec(
base_image="nvidia/cuda:12.2.2-cudnn8-runtime-ubi8",
packages=["flytekit"]
)
or
ImageSpec(
packages=["cudnn"]
)
wdyt
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.
With my recent changes, if people use cuda
with python libraries, then do not need to specify anything extra in ImageSpec
. If they install pytorch
from pypi
or conda
, then it already comes with cuda.
Their Kubernetes setup needs to be configured to inject the GPU driver into the container.
What's remaining to merge this, @thomasjpfan? |
I need to update this to sync up with https://github.com/thomasjpfan/imagespec-fast-builder. I made some pretty big changes to fix issues for current users and to reduce builder's complexity. The last technical thing I am concerned with is, the local buildkit cache which can get corrupted. Usually the fix is |
base_image = image_spec.base_image or "debian:bookworm-slim" | ||
|
||
if image_spec.cuda: | ||
# Base image requires an NVIDIA driver. cuda and cudnn will be installed with conda |
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.
Agree, should we deprecate cuda
, cudnn
?
Thus, if people want to use cuda, they do
ImageSpec(
base_image="nvidia/cuda:12.2.2-cudnn8-runtime-ubi8",
packages=["flytekit"]
)
or
ImageSpec(
packages=["cudnn"]
)
wdyt
…kit_image_builder Signed-off-by: Thomas J. Fan <[email protected]>
…kit_image_builder Signed-off-by: Thomas J. Fan <[email protected]>
Signed-off-by: Thomas J. Fan <[email protected]>
Signed-off-by: Thomas J. Fan <[email protected]>
Signed-off-by: Thomas J. Fan <[email protected]>
…kit_image_builder Signed-off-by: Thomas J. Fan <[email protected]>
Signed-off-by: Thomas J. Fan <[email protected]>
Signed-off-by: Thomas J. Fan <[email protected]>
…n/buildkit_image_builder
Signed-off-by: Thomas J. Fan <[email protected]>
Do you know why the test is failing?
|
Signed-off-by: Thomas J. Fan <[email protected]>
Signed-off-by: Thomas J. Fan <[email protected]>
In I fixed the failing tests in |
Signed-off-by: Thomas J. Fan <[email protected]> Co-authored-by: Kevin Su <[email protected]> Signed-off-by: bugra.gedik <[email protected]>
Signed-off-by: Thomas J. Fan <[email protected]> Co-authored-by: Kevin Su <[email protected]> Signed-off-by: Jan Fiedler <[email protected]>
Signed-off-by: Thomas J. Fan <[email protected]> Co-authored-by: Kevin Su <[email protected]> Signed-off-by: mao3267 <[email protected]>
Why are the changes needed?
This PR adds a default image builder to
flytekit
core, so thatImageSpec
is usable without a theenvd
plugin. I've been dogfooding this implementation in https://github.com/thomasjpfan/imagespec-fast-builder and successfully used it as my default build instead ofenvd
for the past 3 weeks.What is left to do
Currently this PR uses https://hub.docker.com/r/thomasjpfan/default-image-builder-base as the base image for builder. For this be merged into
flytekit
, we'll need to host this inghcr.io/flyteorg
What changes were proposed in this pull request?
The major features in this PR are:
The major difference with this builder and
envd
is that the python packages inbase_image
is ignored. For example, the default builder will not use the python environment fromghcr.io/flyteorg/flytekit
:The best way to use this PR's builder is to not specify
base_image
at all:This PR's builder will use
debian:bookworm-slim
as the base image and copy over the python environment from the build stage. This helps keep the runtime image slim.How was this patch tested?
I added unit tests to check the behavior. I also tested this with https://github.com/flyteorg/flytesnacks/blob/master/examples/customizing_dependencies/customizing_dependencies/image_spec.py by adding
builder="default"
and removing the base image.