Document YuE2 install, weight cleanup, and regression tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-09-14 18:46:35 -05:00
co-authored by Cursor
parent 71a61b1765
commit d1ff05089f
3 changed files with 200 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
"""CPU-only YuE2 worker regression tests; never import torch or run inference."""
import importlib.util
from pathlib import Path
import unittest
spec = importlib.util.spec_from_file_location('yue2_worker', Path(__file__).parents[1] / 'scripts/yue2-worker.py')
worker = importlib.util.module_from_spec(spec)
spec.loader.exec_module(worker)
class WorkerTests(unittest.TestCase):
def test_lyrics_preserve_words_and_normalize_ui_headings(self):
self.assertEqual(worker.normalize_lyrics('[Pre-Chorus]\nEvery word stays\n[Outro]\n'), '[prechorus]\nEvery word stays\n\n')
self.assertEqual(worker.normalize_lyrics('[Verse 1]\nHello'), '[verse1]\nHello\n\n')
for lyrics in ['', 'No heading', '[Verse]\nA\n[Chorus]\nB']:
with self.assertRaises(ValueError):
worker.normalize_lyrics(lyrics)
if __name__ == '__main__':
unittest.main()