Instructions to use AEmotionStudio/yue2-models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AEmotionStudio/yue2-models with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-to-audio", model="AEmotionStudio/yue2-models")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AEmotionStudio/yue2-models", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download sheetsage2/setup_render.py from AEmotionStudio/yue2-models: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/AEmotionStudio/yue2-models/resolve/main/sheetsage2/setup_render.py
- Command line
-
hf download hf://AEmotionStudio/yue2-models/sheetsage2/setup_render.py
-
curl -L -o setup_render.py https://huggingface.co/AEmotionStudio/yue2-models/resolve/main/sheetsage2/setup_render.py
1.54 kB
| """Install the optional renderer and its matching headless browser.""" | |
| from pathlib import Path | |
| import argparse | |
| import subprocess | |
| import sys | |
| SCRIPT_DIR = Path(__file__).absolute().parent | |
| sys.path.insert(0, str(SCRIPT_DIR)) | |
| def main(): | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--with-deps", action="store_true", help="Also install Chromium OS libraries (may require sudo).") | |
| args = parser.parse_args() | |
| subprocess.run([sys.executable, "-m", "pip", "install", "-r", str(SCRIPT_DIR / "requirements-render.txt")], check=True) | |
| command = [sys.executable, "-m", "playwright", "install", "--only-shell", "chromium"] | |
| if args.with_deps: | |
| command.append("--with-deps") | |
| subprocess.run(command, check=True) | |
| check = """from playwright.sync_api import sync_playwright | |
| with sync_playwright() as p: | |
| browser = p.chromium.launch(headless=True, args=['--disable-gpu']) | |
| context = browser.new_context(offline=True) | |
| page = context.new_page() | |
| assert page.evaluate('typeof OfflineAudioContext') == 'function' | |
| browser.close() | |
| """ | |
| result = subprocess.run([sys.executable, "-c", check], capture_output=True, text=True) | |
| if result.returncode: | |
| print("Chromium could not start. On Linux, run python setup_render.py --with-deps to install its system libraries.", file=sys.stderr) | |
| return 1 | |
| print("Rendering is ready. Example: python render.py --input output --audio --score pdf") | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |