Skip to content
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

Reduce size of runtime-adapter image (exclude Python/tensorflow to convert keras models) #59

Open
GolanLevy opened this issue Oct 18, 2023 · 1 comment

Comments

@GolanLevy
Copy link
Contributor

GolanLevy commented Oct 18, 2023

The current image weight is very high (2.14Gb) which slows down the predictor's uptime.

Correct me if I'm wrong please, but the only reason the adapter needs to install tensorflow is to convert keras models to tensorflow models, which sounds weird to do it on runtime and not in advance, see

func convertKerasToTF(kerasFile string, targetPath string, ctx context.Context, loggr logr.Logger) error {
cmd := exec.Command("python", "/opt/scripts/tf_pb.py", kerasFile, targetPath)

# install python to convert keras to tf

pip install tensorflow

COPY --from=build /opt/app/model-mesh-triton-adapter/scripts/tf_pb.py /opt/scripts/

If we remove this option, we can remove the tensorflow installation, and since python is needed only for that, removing the entire python installation.
This reduces the image size from 2.14 GB to 256Mb.

Can we just remove it? If not, can we have two images, the original one and a new slim one?

@ckadner ckadner changed the title Reducing image weight Reduce size of runtime-adapter image (exclude Python/tensorflow to convert keras models) Jan 19, 2024
@ckadner
Copy link
Member

ckadner commented Jan 19, 2024

This is a bit tricky.

We don't want to drop support for Keras models. Requiring users to convert possibly hundreds/thousands of Keras models to Tensorflow prior to deploying them may not be practical.

We could possibly have two images as you suggested: a smaller one without the conversion script and a large one with it. We would need to introduce a install/deployment option in the modelmesh-serving repo.

Users who decide to use the slim image would then be required to do the Keras to TF conversion prior to deploying an ISVC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants