File size: 4,388 Bytes
aed1d05
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env python3
"""
Set up ACE-Step 1.5 as MODEL-W's audio foundation model.

Steps:
  1. Clone the ACE-Step repo into models/ace-step/
  2. Install it as an editable package
  3. Verify imports work
  4. (Optional) Download model weights on first run

Usage:
  python scripts/setup_acestep.py
  python scripts/setup_acestep.py --skip-install   # if you already pip-installed
  python scripts/setup_acestep.py --dit xl-turbo   # pick a different DiT variant
"""

from __future__ import annotations

import argparse
import os
import subprocess
import sys
from pathlib import Path

REPO_URL = "https://github.com/ACE-Step/ACE-Step-1.5.git"
DEFAULT_TARGET = "models/ace-step"

ROOT = Path(__file__).resolve().parents[1]


def run(cmd: list[str], cwd: str | None = None, check: bool = True):
    print(f"  $ {' '.join(cmd)}")
    subprocess.run(cmd, cwd=cwd, check=check)


def main():
    ap = argparse.ArgumentParser(description="Set up ACE-Step 1.5 for MODEL-W")
    ap.add_argument("--target", type=str, default=DEFAULT_TARGET,
                    help="Where to clone ACE-Step (relative to repo root)")
    ap.add_argument("--skip-install", action="store_true",
                    help="Skip pip install (if already installed)")
    ap.add_argument("--dit", type=str, default="turbo",
                    choices=["base", "sft", "turbo", "xl-base", "xl-sft", "xl-turbo"],
                    help="Which DiT variant to configure")
    ap.add_argument("--lm", type=str, default="1.7B",
                    choices=["0.6B", "1.7B", "4B"],
                    help="Which LM model size")
    args = ap.parse_args()

    target = ROOT / args.target

    # 1. Clone if needed
    if not (target / "pyproject.toml").exists():
        print(f"\n[1/4] Cloning ACE-Step 1.5 β†’ {target}")
        target.mkdir(parents=True, exist_ok=True)
        run(["git", "clone", REPO_URL, str(target)])
    else:
        print(f"\n[1/4] ACE-Step already present at {target}")

    # 2. Install
    if not args.skip_install:
        print(f"\n[2/4] Installing ACE-Step as editable package")
        run([sys.executable, "-m", "pip", "install", "-e", str(target)])
    else:
        print("\n[2/4] Skipping install (--skip-install)")

    # 3. Verify imports
    print("\n[3/4] Verifying ACE-Step imports")
    try:
        import acestep  # noqa: F401
        from acestep.handler import AceStepHandler  # noqa: F401
        from acestep.inference import GenerationParams  # noqa: F401
        print("  βœ“ acestep imports OK")
    except ImportError as e:
        print(f"  βœ— Import failed: {e}")
        print("  You may need to install manually: pip install -e models/ace-step")
        sys.exit(1)

    # 4. Write config hint
    dit_name = f"acestep-v15-{args.dit.replace('-', '-')}"
    lm_name = f"acestep-5Hz-lm-{args.lm}"

    config_path = ROOT / ".env.acestep"
    with open(config_path, "w") as f:
        f.write(f"ACESTEP_ROOT={target}\n")
        f.write(f"ACESTEP_DIT_CONFIG={dit_name}\n")
        f.write(f"ACESTEP_LM_MODEL={lm_name}\n")

    print(f"\n[4/4] Config written to {config_path}")
    print(f"  DiT: {dit_name}")
    print(f"  LM:  {lm_name}")

    print(f"""
╔═══════════════════════════════════════════════════════════════╗
β•‘  ACE-Step 1.5 is ready as MODEL-W's audio foundation model  β•‘
β•‘                                                               β•‘
β•‘  Models auto-download on first generation run.               β•‘
β•‘                                                               β•‘
β•‘  Quick test:                                                  β•‘
β•‘    python -m modelw.acestep_bridge synthetic/sessions/corpus_200  β•‘
β•‘                                                               β•‘
β•‘  Generate audio from sessions:                               β•‘
β•‘    python scripts/generate_audio.py \\                         β•‘
β•‘      --sessions synthetic/sessions/corpus_200 \\               β•‘
β•‘      --out output/audio                                       β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
""")


if __name__ == "__main__":
    main()