fix(deps): make torch/ML stack opt-in instead of a mandatory install
requirements-amd.txt/requirements-nvidia.txt were pulling a multi-GB torch wheel by default even though nothing in synapse/ imports torch, transformers, accelerate, bitsandbytes, or PySide6 - dead weight that made the pip batch fragile (one failed download could take unrelated base deps down with it on a slow connection). Split the unused ML/GUI stack out of requirements-base.txt into a new opt-in requirements-ml.txt, and dropped the torch lines from the AMD/NVIDIA overlays and generator. Also: recreate the venv if it exists but pip is missing, instead of silently reusing a half-built one (ensurepip can fail during venv creation and leave an interpreter with no pip). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
409e384be0
commit
3b0354735c
@@ -53,10 +53,9 @@ def main():
|
||||
|
||||
-r requirements-base.txt
|
||||
|
||||
# GPU Compute Stack
|
||||
torch
|
||||
torchaudio
|
||||
torchvision
|
||||
# Torch itself is opt-in — see requirements-ml.txt. The --index-url above is
|
||||
# what makes `pip install -r requirements-nvidia.txt -r requirements-ml.txt`
|
||||
# resolve torch as the matching CUDA build instead of CPU-only.
|
||||
""", newline="\n")
|
||||
|
||||
print(f"\nWritten: {NVIDIA_REQS}")
|
||||
|
||||
+10
@@ -61,6 +61,16 @@ def venv_python() -> Path:
|
||||
"""Path to the Promethean interpreter, creating the venv if it's missing."""
|
||||
venv = ROOT / "Promethean"
|
||||
py = venv / ("Scripts/python.exe" if os.name == "nt" else "bin/python")
|
||||
if py.exists() and subprocess.run(
|
||||
[str(py), "-m", "pip", "--version"], capture_output=True).returncode:
|
||||
# venv creation can partially succeed: the interpreter gets built but
|
||||
# ensurepip's bootstrap fails (e.g. the matching pythonX.Y-venv package
|
||||
# wasn't installed yet), leaving pip missing. Existence of `py` alone
|
||||
# can't tell a venv like that apart from a good one, so a prior failed
|
||||
# run would otherwise be reused forever instead of getting rebuilt now
|
||||
# that whatever broke ensurepip is fixed.
|
||||
print("Existing venv has no pip - recreating it...")
|
||||
shutil.rmtree(venv)
|
||||
if not py.exists():
|
||||
result = subprocess.run([sys.executable, "-m", "venv", str(venv)])
|
||||
if result.returncode:
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
-r requirements-base.txt
|
||||
|
||||
# GPU Compute Stack
|
||||
torch
|
||||
torchaudio
|
||||
torchvision
|
||||
# Torch itself is opt-in — see requirements-ml.txt. The --index-url above is
|
||||
# what makes `pip install -r requirements-amd.txt -r requirements-ml.txt`
|
||||
# resolve torch as the ROCm build instead of CPU-only.
|
||||
|
||||
+1
-10
@@ -1,11 +1,6 @@
|
||||
# --- Shared Base (GPU-agnostic) ---
|
||||
|
||||
# AI Stack
|
||||
transformers
|
||||
accelerate
|
||||
bitsandbytes
|
||||
safetensors
|
||||
sentencepiece
|
||||
# AI Stack (tokenizers/huggingface-hub: faster-whisper deps, not transformers)
|
||||
tokenizers
|
||||
huggingface-hub
|
||||
|
||||
@@ -28,10 +23,6 @@ numpy
|
||||
scipy
|
||||
pandas
|
||||
psutil
|
||||
PySide6
|
||||
PySide6_Addons
|
||||
PySide6_Essentials
|
||||
shiboken6
|
||||
tqdm
|
||||
rich
|
||||
python-dotenv
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# --- Optional: local ML inference stack ---
|
||||
# Nothing in synapse/ imports any of this — Ollama handles all inference over
|
||||
# HTTP. Only install this if you're doing local model work outside Ollama
|
||||
# (fine-tuning, direct transformers inference, etc). Skipping it is what keeps
|
||||
# the default install light and out of a multi-GB torch download.
|
||||
#
|
||||
# This file has no --index-url of its own, so torch resolves as CPU-only
|
||||
# unless you combine it with the GPU overlay that sets one:
|
||||
# pip install -r requirements-amd.txt -r requirements-ml.txt # ROCm
|
||||
# pip install -r requirements-nvidia.txt -r requirements-ml.txt # CUDA
|
||||
# pip install -r requirements-ml.txt # CPU only
|
||||
|
||||
transformers
|
||||
accelerate
|
||||
bitsandbytes
|
||||
safetensors
|
||||
sentencepiece
|
||||
torch
|
||||
torchaudio
|
||||
torchvision
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
-r requirements-base.txt
|
||||
|
||||
# GPU Compute Stack
|
||||
torch
|
||||
torchaudio
|
||||
torchvision
|
||||
# Torch itself is opt-in — see requirements-ml.txt. The --index-url above is
|
||||
# what makes `pip install -r requirements-nvidia.txt -r requirements-ml.txt`
|
||||
# resolve torch as the matching CUDA build instead of CPU-only.
|
||||
|
||||
Reference in New Issue
Block a user