diff --git a/bin/gen-nvidia-reqs.py b/bin/gen-nvidia-reqs.py index 8e1a4df..2bad8a0 100644 --- a/bin/gen-nvidia-reqs.py +++ b/bin/gen-nvidia-reqs.py @@ -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}") diff --git a/bin/sync.py b/bin/sync.py index 4438433..65afe28 100644 --- a/bin/sync.py +++ b/bin/sync.py @@ -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: diff --git a/requirements-amd.txt b/requirements-amd.txt index 7abce69..5407ea7 100644 --- a/requirements-amd.txt +++ b/requirements-amd.txt @@ -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. diff --git a/requirements-base.txt b/requirements-base.txt index 017cf19..523686f 100644 --- a/requirements-base.txt +++ b/requirements-base.txt @@ -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 diff --git a/requirements-ml.txt b/requirements-ml.txt new file mode 100644 index 0000000..2d3fef2 --- /dev/null +++ b/requirements-ml.txt @@ -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 diff --git a/requirements-nvidia.txt b/requirements-nvidia.txt index 66d62fd..5acc628 100644 --- a/requirements-nvidia.txt +++ b/requirements-nvidia.txt @@ -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.