Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (29 loc) · 1.73 KB
/
Copy pathMakefile
File metadata and controls
37 lines (29 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Disstruments — local dev
# Prereqs: python 3.11+, node 18+, ffmpeg (`brew install ffmpeg`)
# Pinned to 3.12: best prebuilt-wheel coverage for the ML extras (torch/demucs/panns).
PYTHON ?= python3.12
API_PORT ?= 8642
WEB_PORT ?= 3642
.PHONY: setup setup-ml leaf-model api web dev test
setup: ## backend deps (fake-ML capable) + frontend deps
cd backend && $(PYTHON) -m venv .venv && .venv/bin/pip install -e ".[dev]"
cd frontend && npm install
setup-ml: ## real ML models (torch/demucs/panns/librosa) — several GB
cd backend && .venv/bin/pip install -e ".[ml]"
sh backend/scripts/fetch_weights.sh
# M5 leaf model: research-only, so it is built locally, never committed (SYSTEMS_DESIGN §4).
SYNTH ?= $(HOME)/datasets/disstruments-synth
LEAF_CKPT ?= $(SYNTH)/preds/m6gain/scratch_cnn_synthetic_v7sg.pt
LEAF_MANIFEST ?= $(SYNTH)/v7serve/manifest.json
leaf-model: ## export our instrument model to ~/.disstruments/models/leaf (needs local renders)
cd backend && .venv/bin/python -m disstruments.ml.models export-onnx --model $(LEAF_CKPT) \
--manifest $(LEAF_MANIFEST) --calib-cache $(SYNTH)/emb \
--calib-root $(HOME)/datasets/openmic/openmic-2018 --out $(HOME)/.disstruments/models/leaf
api: ## run backend on :$(API_PORT)
cd backend && .venv/bin/uvicorn "disstruments.main:get_app" --factory --port $(API_PORT)
api-fake: ## backend with fake ML (no models needed)
cd backend && DISS_FAKE_ML=1 .venv/bin/uvicorn "disstruments.main:get_app" --factory --port $(API_PORT)
web: ## run frontend on :$(WEB_PORT)
cd frontend && DISS_API_PORT=$(API_PORT) npm run dev -- -p $(WEB_PORT)
test: ## backend test suite (fake ML)
cd backend && DISS_FAKE_ML=1 .venv/bin/pytest tests -q