Instructions to use aaaholics/music3-mac16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use aaaholics/music3-mac16 with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download aaaholics/music3-mac16 --local-dir music3-mac16
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Download cli.py from aaaholics/music3-mac16: direct link, hf CLI and curl.
- Browser
- Download file 5.4 kB
-
https://huggingface.co/aaaholics/music3-mac16/resolve/main/cli.py
- Command line
-
hf download hf://aaaholics/music3-mac16/cli.py
-
curl -L -o cli.py https://huggingface.co/aaaholics/music3-mac16/resolve/main/cli.py
5.4 kB
| """cli.py — 项目入口 (PM v0.2 §10)。 | |
| 命令: | |
| python cli.py baseline --seconds 5 # Milestone 1: 跑通并测量 | |
| python cli.py generate "描述" --seconds 30 # 直接生成 (阶段驻留管线) | |
| python cli.py idea "想法" --seconds 30 # 完整 Idea→Music (重写 caption + 生成) | |
| python cli.py webui # 启动 WebUI (浏览器测试入口) | |
| """ | |
| from __future__ import annotations | |
| import sys | |
| from pathlib import Path | |
| import click | |
| ROOT = Path(__file__).parent | |
| def main() -> None: | |
| """Music3-Mac16: MiniMax Music3 on 16GB Apple Silicon Mac.""" | |
| def webui(host: str, port: int) -> None: | |
| """启动 WebUI (浏览器测试入口)。 | |
| 用法: music-minimax webui → 打开 http://127.0.0.1:8642 | |
| """ | |
| import webbrowser | |
| from webui.app import start | |
| url = f"http://{host}:{port}" | |
| click.echo(f"启动 WebUI: {url}") | |
| webbrowser.open(url) | |
| start(host=host, port=port) | |
| def baseline(seconds: int, label: str) -> None: | |
| """Milestone 1: Baseline — 跑通现有 MLX Music3 并记录峰值内存/速度/正确性。""" | |
| from generation.pipeline import BaselineRunner | |
| runner = BaselineRunner(label=label) | |
| runner.run(target_seconds=seconds) | |
| def generate(prompt: str, seconds: int, lyrics: str | None, steps: int, seed: int, | |
| label: str, model: str, experimental_long_form: bool) -> None: | |
| """Idea→Music: 从自然语言描述生成 WAV(阶段驻留管线)。 | |
| 用法: music-minimax generate "dark melodic techno, 128 BPM" --seconds 30 | |
| music-minimax generate "pop ballad" --model models/runtime/MiniMax-Music3-mxfp8 | |
| """ | |
| from generation.phased_pipeline import PhasedPipeline | |
| pipeline = PhasedPipeline(label=label, model_path=model) | |
| output = None | |
| if experimental_long_form: | |
| long_form_dir = ROOT / "outputs" / "long_form_test" / f"{seconds}s" | |
| output = str(long_form_dir / "output.wav") | |
| report = pipeline.generate( | |
| caption=prompt, | |
| lyrics=lyrics or "[instrumental]", | |
| duration=seconds, | |
| steps=steps, | |
| seed=seed, | |
| output=output, | |
| experimental_long_form=experimental_long_form, | |
| ) | |
| click.echo(f"✓ 生成完成: {report['output_wav']}") | |
| click.echo(f" 峰值内存: {report['max_stage_peak_gb']} GB (预算 11.5GB)") | |
| click.echo(f" AR 阶段 : {report['ar_peak_gb']} GB | Flow 阶段: {report['flow_peak_gb']} GB") | |
| def idea(idea: str, lyrics: str | None, seconds: int, rewriter_model: str | None, | |
| label: str, dry_run: bool) -> None: | |
| """Idea→Music 完整工作流: 想法 → caption 重写 → 本地生成 WAV。 | |
| 用法: music-minimax idea "dark melodic techno with female airy vocal, lonely" | |
| """ | |
| from caption.rewriter import rewrite_caption | |
| from generation.phased_pipeline import PhasedPipeline | |
| click.echo("① 重写想法 → 结构化 caption (本地模型)...") | |
| caption = rewrite_caption( | |
| idea=idea, | |
| lyrics=lyrics or "", | |
| model=rewriter_model or "mlx-community/Qwen3-8B-4bit", | |
| ) | |
| click.echo(f"\n── 生成的 caption ──\n{caption}\n─────────────────────") | |
| if dry_run: | |
| click.echo("(--dry-run: 只输出 caption, 不生成音乐)") | |
| return | |
| click.echo(f"② 生成 {seconds}s 音乐 (阶段驻留管线)...") | |
| pipeline = PhasedPipeline(label=label) | |
| report = pipeline.generate( | |
| caption=caption, | |
| lyrics=lyrics or "[instrumental]", | |
| duration=seconds, | |
| ) | |
| click.echo(f"✓ 完整工作流完成: {report['output_wav']}") | |
| click.echo(f" 峰值内存: {report['max_stage_peak_gb']} GB (预算 11.5GB)") | |
| if __name__ == "__main__": | |
| main() | |