Spaces:
Running on Zero
Running on Zero
feat(deploy): vendor ace-step as submodule, skip nano-vllm via sys.path injection
Browse filesace-step's pyproject pins 'nano-vllm; sys_platform != darwin' which isn't
on PyPI (their README says manually 'cd acestep/third_parts/nano-vllm &&
pip install .'). All nano-vllm imports in ace-step are lazy (function-
scoped, try/except wrapped), so the package works without it.
Vendored at vendor/ace-step (git submodule of the apple-silicon fork
which has a looser gradio pin >=6.5.1). requirements.txt now lists
ace-step's transitive deps directly. app.py adds vendor/ace-step to
sys.path BEFORE importing ace_pipeline so 'from acestep import ...'
resolves to the vendored copy.
Upstream updates: 'git submodule update --remote vendor/ace-step'.
- .gitmodules +3 -0
- app.py +12 -1
- pyproject.toml +6 -1
- requirements.txt +25 -8
- vendor/ace-step +1 -0
.gitmodules
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[submodule "vendor/ace-step"]
|
| 2 |
+
path = vendor/ace-step
|
| 3 |
+
url = https://github.com/clockworksquirrel/ace-step-apple-silicon.git
|
app.py
CHANGED
|
@@ -46,11 +46,22 @@ os.environ.setdefault("PYTORCH_ENABLE_MPS_FALLBACK", "1")
|
|
| 46 |
# Don't pin HF download source β let HF default for both Spaces and local cache.
|
| 47 |
os.environ.setdefault("HF_HUB_ENABLE_HF_TRANSFER", "1")
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
import hashlib
|
| 50 |
import random
|
| 51 |
import shutil # noqa: F401 (reserved for future cleanup paths)
|
| 52 |
import subprocess
|
| 53 |
-
from pathlib import Path
|
| 54 |
|
| 55 |
import gradio as gr
|
| 56 |
|
|
|
|
| 46 |
# Don't pin HF download source β let HF default for both Spaces and local cache.
|
| 47 |
os.environ.setdefault("HF_HUB_ENABLE_HF_TRANSFER", "1")
|
| 48 |
|
| 49 |
+
# Vendored ace-step (git submodule at vendor/ace-step/) β added to sys.path
|
| 50 |
+
# BEFORE any module that imports `from acestep import ...`. We vendor
|
| 51 |
+
# instead of pip-installing because the upstream pyproject.toml declares
|
| 52 |
+
# `nano-vllm; sys_platform != "darwin"`, a path-source dep not on PyPI
|
| 53 |
+
# that breaks `pip install -r requirements.txt` on HF Spaces (Linux).
|
| 54 |
+
import sys
|
| 55 |
+
from pathlib import Path
|
| 56 |
+
|
| 57 |
+
_VENDORED_ACE_STEP = Path(__file__).resolve().parent / "vendor" / "ace-step"
|
| 58 |
+
if _VENDORED_ACE_STEP.exists() and str(_VENDORED_ACE_STEP) not in sys.path:
|
| 59 |
+
sys.path.insert(0, str(_VENDORED_ACE_STEP))
|
| 60 |
+
|
| 61 |
import hashlib
|
| 62 |
import random
|
| 63 |
import shutil # noqa: F401 (reserved for future cleanup paths)
|
| 64 |
import subprocess
|
|
|
|
| 65 |
|
| 66 |
import gradio as gr
|
| 67 |
|
pyproject.toml
CHANGED
|
@@ -13,12 +13,17 @@ target-version = "py311"
|
|
| 13 |
# checkpoints/ holds downloaded model code shipped by upstream HF repos β
|
| 14 |
# linting third-party drop-ins isn't our concern. output/ and research/
|
| 15 |
# are runtime artefacts / scratch.
|
| 16 |
-
extend-exclude = ["checkpoints", "output", "research", ".venv"]
|
| 17 |
|
| 18 |
[tool.ruff.lint]
|
| 19 |
select = ["E", "F", "I", "B", "UP", "RUF"]
|
| 20 |
ignore = ["E501"]
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
[tool.pytest.ini_options]
|
| 23 |
addopts = "-m 'not gpu' --tb=short"
|
| 24 |
markers = ["gpu: requires a real GPU/MPS device; opt in with -m gpu"]
|
|
|
|
| 13 |
# checkpoints/ holds downloaded model code shipped by upstream HF repos β
|
| 14 |
# linting third-party drop-ins isn't our concern. output/ and research/
|
| 15 |
# are runtime artefacts / scratch.
|
| 16 |
+
extend-exclude = ["checkpoints", "output", "research", ".venv", "vendor"]
|
| 17 |
|
| 18 |
[tool.ruff.lint]
|
| 19 |
select = ["E", "F", "I", "B", "UP", "RUF"]
|
| 20 |
ignore = ["E501"]
|
| 21 |
|
| 22 |
+
[tool.ruff.lint.per-file-ignores]
|
| 23 |
+
# app.py needs sys.path injection (vendored ace-step submodule) BEFORE the
|
| 24 |
+
# remaining imports β E402 (module-level-import-not-at-top) is intentional.
|
| 25 |
+
"app.py" = ["E402"]
|
| 26 |
+
|
| 27 |
[tool.pytest.ini_options]
|
| 28 |
addopts = "-m 'not gpu' --tb=short"
|
| 29 |
markers = ["gpu: requires a real GPU/MPS device; opt in with -m gpu"]
|
requirements.txt
CHANGED
|
@@ -1,21 +1,38 @@
|
|
| 1 |
-
# gradio is injected by HF Spaces per README sdk_version
|
| 2 |
-
#
|
| 3 |
-
transformers>=4.
|
| 4 |
torch>=2.4
|
| 5 |
torchaudio>=2.4
|
| 6 |
safetensors>=0.4
|
| 7 |
peft>=0.13
|
| 8 |
demucs>=4.0
|
| 9 |
pyloudnorm>=0.1.1
|
| 10 |
-
soundfile>=0.
|
| 11 |
librosa>=0.10
|
| 12 |
huggingface_hub>=0.25
|
| 13 |
hf_transfer>=0.1.9
|
| 14 |
numpy>=1.26,<2
|
| 15 |
-
#
|
| 16 |
-
#
|
| 17 |
-
#
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
# HF Spaces ZeroGPU. Do NOT pin β HF's ZeroGPU build injects its own version
|
| 20 |
# and a pin causes pip-resolve failure. Locally the `import spaces` in
|
| 21 |
# app._maybe_spaces_gpu() is wrapped in try/except so absence is fine.
|
|
|
|
| 1 |
+
# gradio is injected by HF Spaces per README sdk_version (6.14.0).
|
| 2 |
+
# transformers β pinned narrower to match ace-step's range (4.51.0β4.57.x).
|
| 3 |
+
transformers>=4.51.0,<4.58.0
|
| 4 |
torch>=2.4
|
| 5 |
torchaudio>=2.4
|
| 6 |
safetensors>=0.4
|
| 7 |
peft>=0.13
|
| 8 |
demucs>=4.0
|
| 9 |
pyloudnorm>=0.1.1
|
| 10 |
+
soundfile>=0.13.1
|
| 11 |
librosa>=0.10
|
| 12 |
huggingface_hub>=0.25
|
| 13 |
hf_transfer>=0.1.9
|
| 14 |
numpy>=1.26,<2
|
| 15 |
+
# --- ace-step's transitive deps (NOT installing ace-step itself; it's
|
| 16 |
+
# vendored as a git submodule at vendor/ace-step. The submodule's
|
| 17 |
+
# pyproject pins nano-vllm; sys_platform != "darwin" which isn't on PyPI,
|
| 18 |
+
# so we list ace-step's deps directly and bypass the pip install of the
|
| 19 |
+
# package. app.py adds vendor/ace-step to sys.path before importing. ---
|
| 20 |
+
diffusers
|
| 21 |
+
matplotlib>=3.7.5
|
| 22 |
+
scipy>=1.10.1
|
| 23 |
+
loguru>=0.7.3
|
| 24 |
+
einops>=0.8.1
|
| 25 |
+
accelerate>=1.12.0
|
| 26 |
+
fastapi>=0.110.0
|
| 27 |
+
diskcache
|
| 28 |
+
uvicorn[standard]>=0.27.0
|
| 29 |
+
numba>=0.63.1
|
| 30 |
+
vector-quantize-pytorch>=1.27.15
|
| 31 |
+
torchcodec>=0.9.1
|
| 32 |
+
torchao
|
| 33 |
+
toml
|
| 34 |
+
lightning>=2.0.0
|
| 35 |
+
modelscope
|
| 36 |
# HF Spaces ZeroGPU. Do NOT pin β HF's ZeroGPU build injects its own version
|
| 37 |
# and a pin causes pip-resolve failure. Locally the `import spaces` in
|
| 38 |
# app._maybe_spaces_gpu() is wrapped in try/except so absence is fine.
|
vendor/ace-step
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Subproject commit 8637c8299f87faecae815565da5ef52d9a93eb4c
|