43 lines
1023 B
Python
43 lines
1023 B
Python
"""Render all promo scenes with Manim."""
|
|
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).parent
|
|
|
|
SCENES = [
|
|
("transformer.py", "Transformer"),
|
|
("architecture.py", "Architecture"),
|
|
("continuous_batching.py", "ContinuousBatching"),
|
|
("paged_cache.py", "PrefixCache"),
|
|
("cta.py", "CTA"),
|
|
]
|
|
|
|
|
|
def render(file_name, scene_name, quality="-qh"):
|
|
script_path = ROOT / file_name
|
|
media_dir = ROOT / "output"
|
|
cmd = [
|
|
sys.executable,
|
|
"-m",
|
|
"manim",
|
|
str(script_path),
|
|
scene_name,
|
|
quality,
|
|
"--media_dir",
|
|
str(media_dir),
|
|
]
|
|
print(f"Rendering {scene_name}...")
|
|
subprocess.run(cmd, check=True)
|
|
print(f" Done → {media_dir / 'videos' / scene_name.lower()}.mp4")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
quality = "-qh" # 1080p; use -l for draft, -4k for ultra
|
|
if len(sys.argv) > 1:
|
|
quality = sys.argv[1]
|
|
for f, s in SCENES:
|
|
render(f, s, quality)
|
|
print("All scenes rendered.")
|