Make CI tests light: defer torch/demucs to a prod-only requirements file
CI's test job was installing torch + demucs (a neural net stem-separation model) on every single push even though nothing in the test suite calls the real separator - test_remix.py mocks render_remix_sync entirely, and remix_engine.py's own detect_key/sidechain/style-preset tests only need librosa/scipy/numpy/pedalboard, not torch. That's most of what was making the pipeline slow (torch alone is a large download+install, on top of the memory pressure that caused the earlier 5min stall). - src/services/remix_engine.py: `import torch` and the mkldnn tweak move from module level into _get_separator(), alongside the already-lazy demucs import. The module (and everything depending on it, like the /remix router) now imports cleanly with neither installed. - requirements.txt: demucs removed. numpy/scipy/librosa/soundfile/pedalboard stay - real libraries, but not the heavy part, and needed for the audio- math tests that do run in CI. - requirements-remix.txt (new): just demucs, install torch CPU-only before it. Only installed by deploy.sh (prod), never in CI. - .gitlab-ci.yml test job: drops the torch install step entirely. Verified locally: uninstalled torch+demucs from the dev venv, app still imports and all 104 tests still pass in ~3s. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
Showing
requirements-remix.txt
0 → 100644
| ... | ... | @@ -23,14 +23,13 @@ tgcrypto>=1.2.5 |
| pyjwt>=2.8.0 | ||
| alembic>=1.13.0 | ||
| # Remix engine. Install torch CPU-only *before* this file, this VPS has no GPU: | ||
| # pip install torch --index-url https://download.pytorch.org/whl/cpu | ||
| # Otherwise pip pulls the default CUDA wheel (multiple GB, useless here). | ||
| # numpy is pinned <2: this VPS's virtualized CPU exposes no SSE3/SSE4/AVX at all, | ||
| # and numpy>=2's default wheels require the x86-64-v2 baseline and segfault/RuntimeError | ||
| # on import here. 1.26.4 is what the rest of this project already runs on successfully. | ||
| # Remix engine's audio-math helpers (key detection, sidechain envelope, style presets) - | ||
| # real libraries, but nowhere near as heavy as the stem-separation model in | ||
| # requirements-remix.txt, and everything that needs these is covered by tests/test_remix_engine.py. | ||
| # numpy is pinned <2: this VPS's virtualized CPU exposes no SSE3/SSE4/AVX at all, and | ||
| # numpy>=2's default wheels require the x86-64-v2 baseline and segfault/RuntimeError on | ||
| # import here. 1.26.4 is what the rest of this project already runs on successfully. | ||
| numpy==1.26.4 | ||
| scipy==1.13.1 | ||
| demucs>=4.0.1 | ||
| librosa>=0.10.2 | ||
| soundfile>=0.12.1 |
Please
register
or
sign in
to comment