Spaces:
Running on Zero
Running on Zero
Upload folder using huggingface_hub
Browse files- README.md +9 -5
- app.py +26 -6
- presets.py +25 -15
- requirements.txt +2 -1
README.md
CHANGED
|
@@ -12,9 +12,10 @@ license: mit
|
|
| 12 |
short_description: Creative ACE-Step 1.5 text-to-song with genre-first UI
|
| 13 |
suggested_hardware: zero-a10g
|
| 14 |
models:
|
| 15 |
-
-
|
| 16 |
-
- ACE-Step/acestep-v15-base
|
| 17 |
- ACE-Step/acestep-v15-xl-turbo-diffusers
|
|
|
|
|
|
|
| 18 |
tags:
|
| 19 |
- music
|
| 20 |
- text-to-audio
|
|
@@ -31,16 +32,19 @@ Official demos expose many technical controls and can feel unreliable. This Spac
|
|
| 31 |
|
| 32 |
- Guides you with **genre → style → mood → tempo → lyrics**
|
| 33 |
- Keeps expert diffusion settings collapsed
|
| 34 |
-
- Defaults to
|
| 35 |
- Treats **lyric generation as the primary path** (editable afterward)
|
| 36 |
|
| 37 |
## Models
|
| 38 |
|
|
|
|
|
|
|
| 39 |
| UI label | Repo |
|
| 40 |
|----------|------|
|
| 41 |
-
|
|
| 42 |
-
| Base | `ACE-Step/acestep-v15-base` |
|
| 43 |
| XL Turbo | `ACE-Step/acestep-v15-xl-turbo-diffusers` |
|
|
|
|
|
|
|
| 44 |
|
| 45 |
Built with [`diffusers.AceStepPipeline`](https://huggingface.co/docs/diffusers/api/pipelines/ace_step).
|
| 46 |
|
|
|
|
| 12 |
short_description: Creative ACE-Step 1.5 text-to-song with genre-first UI
|
| 13 |
suggested_hardware: zero-a10g
|
| 14 |
models:
|
| 15 |
+
- Runware/acestep-v15-turbo-diffusers
|
|
|
|
| 16 |
- ACE-Step/acestep-v15-xl-turbo-diffusers
|
| 17 |
+
- ACE-Step/acestep-v15-xl-sft-diffusers
|
| 18 |
+
- ACE-Step/acestep-v15-xl-base-diffusers
|
| 19 |
tags:
|
| 20 |
- music
|
| 21 |
- text-to-audio
|
|
|
|
| 32 |
|
| 33 |
- Guides you with **genre → style → mood → tempo → lyrics**
|
| 34 |
- Keeps expert diffusion settings collapsed
|
| 35 |
+
- Defaults to **non-XL Turbo** in Diffusers format (ZeroGPU-friendly)
|
| 36 |
- Treats **lyric generation as the primary path** (editable afterward)
|
| 37 |
|
| 38 |
## Models
|
| 39 |
|
| 40 |
+
Only Diffusers `AceStepPipeline` checkpoints are supported:
|
| 41 |
+
|
| 42 |
| UI label | Repo |
|
| 43 |
|----------|------|
|
| 44 |
+
| Turbo non-XL (default) | `Runware/acestep-v15-turbo-diffusers` |
|
|
|
|
| 45 |
| XL Turbo | `ACE-Step/acestep-v15-xl-turbo-diffusers` |
|
| 46 |
+
| XL SFT | `ACE-Step/acestep-v15-xl-sft-diffusers` |
|
| 47 |
+
| XL Base | `ACE-Step/acestep-v15-xl-base-diffusers` |
|
| 48 |
|
| 49 |
Built with [`diffusers.AceStepPipeline`](https://huggingface.co/docs/diffusers/api/pipelines/ace_step).
|
| 50 |
|
app.py
CHANGED
|
@@ -52,7 +52,13 @@ def _load_pipe(repo_id: str) -> AceStepPipeline:
|
|
| 52 |
return _pipes[repo_id]
|
| 53 |
# Keep only one heavy pipeline in memory on ZeroGPU
|
| 54 |
_pipes.clear()
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
if hasattr(pipe, "vae") and hasattr(pipe.vae, "enable_tiling"):
|
| 57 |
pipe.vae.enable_tiling()
|
| 58 |
_pipes[repo_id] = pipe
|
|
@@ -64,6 +70,16 @@ def _model_cfg(model_name: str) -> dict:
|
|
| 64 |
return MODELS.get(model_name, MODELS[DEFAULT_MODEL])
|
| 65 |
|
| 66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
def apply_genre(genre: str):
|
| 68 |
"""Fill creative defaults from genre (all still user-overridable)."""
|
| 69 |
g = GENRES[genre]
|
|
@@ -221,8 +237,12 @@ def _generate_impl(
|
|
| 221 |
task_type="text2music",
|
| 222 |
)
|
| 223 |
|
| 224 |
-
|
| 225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
if isinstance(audio, torch.Tensor):
|
| 227 |
audio = audio.detach().float().cpu().numpy()
|
| 228 |
if audio.ndim == 2:
|
|
@@ -273,7 +293,7 @@ with gr.Blocks(title="ACE-Step Inspire", theme=gr.themes.Soft(primary_hue="green
|
|
| 273 |
choices=list(MODELS.keys()),
|
| 274 |
value=DEFAULT_MODEL,
|
| 275 |
label="Model",
|
| 276 |
-
info="Default is non-XL
|
| 277 |
)
|
| 278 |
duration = gr.Number(
|
| 279 |
value=DEFAULT_DURATION,
|
|
@@ -416,8 +436,8 @@ with gr.Blocks(title="ACE-Step Inspire", theme=gr.themes.Soft(primary_hue="green
|
|
| 416 |
"""
|
| 417 |
---
|
| 418 |
**Tips:** Start with **Generate lyrics** → **Build prompt** → **Generate song**.
|
| 419 |
-
|
| 420 |
-
Lyrics
|
| 421 |
"""
|
| 422 |
)
|
| 423 |
|
|
|
|
| 52 |
return _pipes[repo_id]
|
| 53 |
# Keep only one heavy pipeline in memory on ZeroGPU
|
| 54 |
_pipes.clear()
|
| 55 |
+
try:
|
| 56 |
+
pipe = AceStepPipeline.from_pretrained(repo_id, torch_dtype=torch.bfloat16)
|
| 57 |
+
except Exception as e:
|
| 58 |
+
raise gr.Error(
|
| 59 |
+
f"Failed to load model `{repo_id}`.\n"
|
| 60 |
+
f"This Space only supports Diffusers AceStepPipeline checkpoints.\n\n{e}"
|
| 61 |
+
) from e
|
| 62 |
if hasattr(pipe, "vae") and hasattr(pipe.vae, "enable_tiling"):
|
| 63 |
pipe.vae.enable_tiling()
|
| 64 |
_pipes[repo_id] = pipe
|
|
|
|
| 70 |
return MODELS.get(model_name, MODELS[DEFAULT_MODEL])
|
| 71 |
|
| 72 |
|
| 73 |
+
# Preload default checkpoint on CPU during startup so ZeroGPU time isn't spent downloading.
|
| 74 |
+
try:
|
| 75 |
+
_DEFAULT_REPO = MODELS[DEFAULT_MODEL]["repo_id"]
|
| 76 |
+
print(f"[startup] Preloading {_DEFAULT_REPO} on CPU…")
|
| 77 |
+
_load_pipe(_DEFAULT_REPO)
|
| 78 |
+
print("[startup] Default model ready")
|
| 79 |
+
except Exception as e:
|
| 80 |
+
print(f"[startup] Default model preload skipped: {e}")
|
| 81 |
+
|
| 82 |
+
|
| 83 |
def apply_genre(genre: str):
|
| 84 |
"""Fill creative defaults from genre (all still user-overridable)."""
|
| 85 |
g = GENRES[genre]
|
|
|
|
| 237 |
task_type="text2music",
|
| 238 |
)
|
| 239 |
|
| 240 |
+
try:
|
| 241 |
+
output = pipe(**kwargs)
|
| 242 |
+
audio = output.audios[0]
|
| 243 |
+
except Exception as e:
|
| 244 |
+
raise gr.Error(f"Generation failed:\n{type(e).__name__}: {e}") from e
|
| 245 |
+
|
| 246 |
if isinstance(audio, torch.Tensor):
|
| 247 |
audio = audio.detach().float().cpu().numpy()
|
| 248 |
if audio.ndim == 2:
|
|
|
|
| 293 |
choices=list(MODELS.keys()),
|
| 294 |
value=DEFAULT_MODEL,
|
| 295 |
label="Model",
|
| 296 |
+
info="Default is non-XL Turbo (Diffusers). XL SFT is slower but often richer.",
|
| 297 |
)
|
| 298 |
duration = gr.Number(
|
| 299 |
value=DEFAULT_DURATION,
|
|
|
|
| 436 |
"""
|
| 437 |
---
|
| 438 |
**Tips:** Start with **Generate lyrics** → **Build prompt** → **Generate song**.
|
| 439 |
+
Default model is **non-XL Turbo** (works reliably on ZeroGPU). Use **XL SFT** for quality when you can wait.
|
| 440 |
+
Lyrics use a creative composer tuned to genre/mood. ACE-Step’s 5Hz planner LM is not loaded here (keeps the Space lean).
|
| 441 |
"""
|
| 442 |
)
|
| 443 |
|
presets.py
CHANGED
|
@@ -475,33 +475,43 @@ VOCAL_LANGUAGES: dict[str, str] = {
|
|
| 475 |
"Russian": "ru",
|
| 476 |
}
|
| 477 |
|
|
|
|
|
|
|
| 478 |
MODELS: dict[str, dict] = {
|
| 479 |
-
"
|
| 480 |
-
"repo_id": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 481 |
"steps": 28,
|
| 482 |
"guidance": 7.0,
|
| 483 |
"shift": 3.0,
|
| 484 |
"turbo": False,
|
| 485 |
-
"gpu_seconds":
|
| 486 |
},
|
| 487 |
-
"Base (more diversity,
|
| 488 |
-
"repo_id": "ACE-Step/acestep-v15-base",
|
| 489 |
"steps": 32,
|
| 490 |
"guidance": 7.0,
|
| 491 |
"shift": 3.0,
|
| 492 |
"turbo": False,
|
| 493 |
-
"gpu_seconds":
|
| 494 |
-
},
|
| 495 |
-
"XL Turbo (fast, ZeroGPU-friendly)": {
|
| 496 |
-
"repo_id": "ACE-Step/acestep-v15-xl-turbo-diffusers",
|
| 497 |
-
"steps": 8,
|
| 498 |
-
"guidance": 1.0,
|
| 499 |
-
"shift": 3.0,
|
| 500 |
-
"turbo": True,
|
| 501 |
-
"gpu_seconds": 180,
|
| 502 |
},
|
| 503 |
}
|
| 504 |
|
| 505 |
-
DEFAULT_MODEL = "
|
| 506 |
DEFAULT_GENRE = "Pop"
|
| 507 |
DEFAULT_DURATION = 180
|
|
|
|
| 475 |
"Russian": "ru",
|
| 476 |
}
|
| 477 |
|
| 478 |
+
# Only Diffusers-format AceStepPipeline checkpoints work in this Space.
|
| 479 |
+
# Native transformers checkpoints (acestep-v15-sft / base / Ace-Step1.5) need the full ACE-Step package.
|
| 480 |
MODELS: dict[str, dict] = {
|
| 481 |
+
"Turbo (non-XL) — default": {
|
| 482 |
+
"repo_id": "Runware/acestep-v15-turbo-diffusers",
|
| 483 |
+
"steps": 8,
|
| 484 |
+
"guidance": 1.0,
|
| 485 |
+
"shift": 3.0,
|
| 486 |
+
"turbo": True,
|
| 487 |
+
"gpu_seconds": 180,
|
| 488 |
+
},
|
| 489 |
+
"XL Turbo (faster / larger)": {
|
| 490 |
+
"repo_id": "ACE-Step/acestep-v15-xl-turbo-diffusers",
|
| 491 |
+
"steps": 8,
|
| 492 |
+
"guidance": 1.0,
|
| 493 |
+
"shift": 3.0,
|
| 494 |
+
"turbo": True,
|
| 495 |
+
"gpu_seconds": 200,
|
| 496 |
+
},
|
| 497 |
+
"XL SFT (higher quality, slower)": {
|
| 498 |
+
"repo_id": "ACE-Step/acestep-v15-xl-sft-diffusers",
|
| 499 |
"steps": 28,
|
| 500 |
"guidance": 7.0,
|
| 501 |
"shift": 3.0,
|
| 502 |
"turbo": False,
|
| 503 |
+
"gpu_seconds": 360,
|
| 504 |
},
|
| 505 |
+
"XL Base (more diversity, slower)": {
|
| 506 |
+
"repo_id": "ACE-Step/acestep-v15-xl-base-diffusers",
|
| 507 |
"steps": 32,
|
| 508 |
"guidance": 7.0,
|
| 509 |
"shift": 3.0,
|
| 510 |
"turbo": False,
|
| 511 |
+
"gpu_seconds": 360,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 512 |
},
|
| 513 |
}
|
| 514 |
|
| 515 |
+
DEFAULT_MODEL = "Turbo (non-XL) — default"
|
| 516 |
DEFAULT_GENRE = "Pop"
|
| 517 |
DEFAULT_DURATION = 180
|
requirements.txt
CHANGED
|
@@ -2,7 +2,8 @@
|
|
| 2 |
torch
|
| 3 |
torchaudio
|
| 4 |
torchvision
|
| 5 |
-
|
|
|
|
| 6 |
transformers>=4.51.0
|
| 7 |
accelerate>=1.12.0
|
| 8 |
safetensors
|
|
|
|
| 2 |
torch
|
| 3 |
torchaudio
|
| 4 |
torchvision
|
| 5 |
+
# AceStepPipeline needs a recent Diffusers (0.38+)
|
| 6 |
+
diffusers>=0.38.0
|
| 7 |
transformers>=4.51.0
|
| 8 |
accelerate>=1.12.0
|
| 9 |
safetensors
|