mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-24 12:26:01 +08:00
feat: use uv sources for CPU-only PyTorch (#11833)
* feat: use uv sources for CPU-only PyTorch Configure [tool.uv.sources] with pytorch-cpu index to avoid ~6GB CUDA dependencies in Docker images. This replaces hardcoded wheel URLs with a cleaner index-based approach. - Add pytorch-cpu index with explicit = true - Add torch/torchvision to [tool.uv.sources] - Add explicit torch/torchvision deps to trigger source override - Regenerate lockfile without nvidia/cuda/triton packages * fix: address CodeRabbit review issues for PR #11833 - Add Windows AMD64 platform support to required-environments - Add inline comments explaining architecture naming differences across OSes - Document why loose version ranges are used (avoid conflicts with transitive deps like altk) - Exclude Windows ARM64 due to missing wheels for dependencies like faiss-cpu - Update comments to reflect multi-platform support (Linux, macOS, Windows) Resolves CodeRabbit issues: 1. Windows platform missing from required-environments 2. Clarifies rationale for loose torch/torchvision version ranges The loose version ranges (>=2.0.0) are intentional to avoid conflicts with transitive dependencies (e.g., agent-lifecycle-toolkit requires torch==2.2.2). The uv sources configuration ensures CPU-only PyTorch wheels are used for all platforms (verified in lockfile: torch 2.10.0+cpu for Linux/Windows). * fixed * fix: reduce Node.js heap size to 4GB in Docker builds to prevent OOM The Vite frontend build was configured with --max-old-space-size=12288 (12GB), which exceeds available RAM on ARM64 CI runners, causing the build process to be OOM-killed during the transform phase. Reduced to 4GB (4096MB) which is sufficient for the Vite build and prevents OOM kills in memory-constrained Docker BuildKit environments. * fix: avoid redundant recursive chown on /app in backend Dockerfile The recursive chown -R on /app was re-owning the entire .venv (~2.6GB, 40k+ files) which was already correctly owned via COPY --chown=1000:0. This was causing the build to be killed on ARM64 runners. Changed to non-recursive chown on /app since only the directory itself needs ownership set. /app/data still gets recursive chown (it's empty). * fix: add Docker cleanup between image builds to prevent disk full The 40GB ARM64 runner runs out of disk when building 3 Docker images sequentially. Each image (main ~8GB layers, backend ~5GB, frontend) accumulates build cache and layers that exhaust the disk. Added cleanup steps between builds that: - Remove the tested image (no longer needed) - Prune all unused Docker data and buildx cache - Log disk usage before/after for debugging --------- Co-authored-by: vijay kumar katuri <vijay.katuri@ibm.com>
This commit is contained in:
committed by
GitHub
parent
0f5ace2e30
commit
355a4aa7fc
@ -73,10 +73,17 @@ dev = [
|
||||
"mcp-server-fetch>=2025.1.17",
|
||||
]
|
||||
|
||||
[[tool.uv.index]]
|
||||
name = "pytorch-cpu"
|
||||
url = "https://download.pytorch.org/whl/cpu"
|
||||
explicit = true
|
||||
|
||||
[tool.uv.sources]
|
||||
langflow-base = { workspace = true }
|
||||
langflow = { workspace = true }
|
||||
lfx = { workspace = true }
|
||||
torch = { index = "pytorch-cpu" }
|
||||
torchvision = { index = "pytorch-cpu" }
|
||||
|
||||
[tool.uv.workspace]
|
||||
members = [
|
||||
@ -98,6 +105,10 @@ docling = [
|
||||
"tesserocr>=2.8.0",
|
||||
"rapidocr-onnxruntime>=1.4.4",
|
||||
"ocrmac>=1.0.0; sys_platform == 'darwin'",
|
||||
# CPU-only PyTorch required for docling features
|
||||
# Loose version ranges intentionally used to avoid conflicts with transitive dependencies (e.g., altk)
|
||||
"torch>=2.0.0",
|
||||
"torchvision>=0.15.0",
|
||||
]
|
||||
|
||||
audio = [
|
||||
@ -135,6 +146,18 @@ postgresql = [
|
||||
]
|
||||
|
||||
[tool.uv]
|
||||
# Ensure lockfile resolves packages for Linux, macOS, and Windows platforms
|
||||
# Required because we have platform-specific torch CPU wheels
|
||||
# Without this, builds fail with --frozen as they can't find compatible wheels
|
||||
# Note: Architecture names differ by OS (Linux: x86_64/aarch64, Windows: AMD64/ARM64)
|
||||
# Note: Windows ARM64 excluded due to lack of wheels for some dependencies (e.g., faiss-cpu)
|
||||
required-environments = [
|
||||
"sys_platform == 'linux' and platform_machine == 'x86_64'", # Linux Intel/AMD 64-bit
|
||||
"sys_platform == 'linux' and platform_machine == 'aarch64'", # Linux ARM 64-bit
|
||||
"sys_platform == 'darwin'", # macOS (both Intel and Apple Silicon)
|
||||
"sys_platform == 'win32' and platform_machine == 'AMD64'", # Windows Intel/AMD 64-bit
|
||||
]
|
||||
|
||||
override-dependencies = [
|
||||
# temporary force a newer python-pptx
|
||||
"python-pptx>=1.0.2",
|
||||
|
||||
Reference in New Issue
Block a user