Skip to content

Commit f6204ae

Browse files
SimplicityGuyclaude
andcommitted
fix: use sentence-transformers[onnx] to prevent PyTorch CUDA installation
- Replace sentence-transformers with sentence-transformers[onnx] to avoid PyTorch dependency - Use ONNX backend for CPU-only inference, saving gigabytes of disk space - Update both root and discovery pyproject.toml files - Regenerate uv.lock with new ONNX-based dependencies - Resolves GitHub Actions build failures due to disk space exhaustion from CUDA libraries 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d7aada7 commit f6204ae

5 files changed

Lines changed: 27 additions & 14 deletions

File tree

discovery/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ COPY common/pyproject.toml ./common/
2525
COPY discovery/pyproject.toml ./discovery/
2626
COPY discovery/constraints.txt ./discovery/
2727

28-
# Install dependencies
28+
# Install dependencies (sentence-transformers[onnx] excludes PyTorch)
2929
# hadolint ignore=SC2015
3030
RUN --mount=type=cache,target=/tmp/.cache/uv \
3131
uv sync --frozen --no-dev --extra discovery && \

discovery/constraints.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
# Constraints file to exclude PyTorch and use ONNX Runtime instead
2-
# This significantly reduces the Docker image size
2+
# This significantly reduces the Docker image size and prevents CUDA installation
33

4+
cuda*==0.0.0
5+
6+
# Prevent any CUDA-related packages
7+
nvidia-*==0.0.0
48

59
# Use CPU-only ONNX Runtime
610
onnxruntime!=*gpu*
7-
# Exclude PyTorch completely
11+
onnxruntime-gpu==0.0.0
12+
# Exclude all PyTorch packages to prevent CUDA downloads
813
torch==0.0.0
14+
15+
# Force sentence-transformers to use ONNX backend only
16+
torch-audio==0.0.0
17+
torchaudio==0.0.0
18+
torchtext==0.0.0
19+
torchvision==0.0.0

discovery/pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ dependencies = [
4444
"onnx>=1.14.0", # ONNX format
4545
"onnxruntime>=1.16.0", # ONNX inference runtime
4646
"optimum[onnxruntime]>=1.13.0", # HuggingFace ONNX optimization
47-
# Note: sentence-transformers is installed but PyTorch is excluded
48-
"sentence-transformers>=2.2.0", # Semantic search
49-
"transformers>=4.30.0", # Required by sentence-transformers
47+
# Note: sentence-transformers with ONNX backend (no PyTorch needed)
48+
"sentence-transformers[onnx]>=2.2.0", # Semantic search with ONNX backend
5049
"plotly>=5.17.0", # Advanced visualizations
5150
"sqlalchemy[asyncio]>=2.0.0", # Async SQL toolkit
5251
]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ discovery = [
9090
"numpy>=1.26.0", # Numerical computations
9191
"pandas>=2.1.0", # Data analysis
9292
"scikit-learn>=1.3.0", # Machine learning
93-
"sentence-transformers>=2.2.0", # Semantic search
93+
"sentence-transformers[onnx]>=2.2.0", # Semantic search with ONNX backend
9494
"plotly>=5.17.0", # Advanced visualizations
9595
"sqlalchemy[asyncio]>=2.0.0", # Async SQL toolkit
9696
"asyncpg>=0.29.0", # Async PostgreSQL driver

uv.lock

Lines changed: 10 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)