Skip to content

fix(kagent-feast-mcp): pin torch to CPU-only wheel to reduce image size by ~2.3GB#199

Open
Kunal-Somani wants to merge 1 commit intokubeflow:mainfrom
Kunal-Somani:fix/issue-198-cpu-torch-dockerfile
Open

fix(kagent-feast-mcp): pin torch to CPU-only wheel to reduce image size by ~2.3GB#199
Kunal-Somani wants to merge 1 commit intokubeflow:mainfrom
Kunal-Somani:fix/issue-198-cpu-torch-dockerfile

Conversation

@Kunal-Somani
Copy link
Copy Markdown

Summary

Fixes #198

requirements.txt listed bare torch which installs the full CUDA-enabled wheel (~2.5GB) by default. The Dockerfile uses python:3.10-slim — a CPU-only base image with no CUDA drivers. The embedding model (all-mpnet-base-v2) runs on CPU regardless, making the entire CUDA payload dead weight.

Root Cause

# Before
torch   ← pip installs full CUDA wheel (~2.5GB) by default
FROM python:3.10-slim   ← CPU-only, no CUDA drivers available

Fix

# After
torch --index-url https://download.pytorch.org/whl/cpu

Impact

Before After
torch wheel size ~2.5GB (CUDA) ~200MB (CPU)
Final image size ~3.5GB ~1GB
Runtime behavior CPU inference CPU inference (identical)
Cold-start time 3-4x slower Baseline

No change in functionality — the model runs on CPU in both cases.

Checklist

requirements.txt listed bare 'torch' which installs the full CUDA
wheel (~2.5GB) by default. The Dockerfile uses python:3.10-slim — a
CPU-only base image with no CUDA drivers. The embedding model runs on
CPU regardless, so the CUDA payload is entirely dead weight.

Pin torch to the official CPU-only index URL, reducing the installed
wheel from ~2.5GB to ~200MB and the final Docker image from ~3.5GB
to under 1GB with no change in runtime behavior.

Fixes kubeflow#198

Signed-off-by: Kunal <kunal120222@gmail.com>
@google-oss-prow
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign franciscojavierarceo for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(kagent-feast-mcp): requirements.txt installs full CUDA torch (~2.5GB) on a CPU-only base image

1 participant