Spaces:
Sleeping
Sleeping
futurespyhi
Claude
commited on
Commit
·
a128360
1
Parent(s):
2ab39a8
Fix split_lyrics regex to properly detect all lyric segments
Browse files- Update regex pattern from \[(\w+)\] to \[([^]]+)\] to handle numbered verses
- Previous pattern only matched CHORUS, missing VERSE 1, VERSE 2, etc.
- Now correctly identifies all segments for proper YuEGP music generation
- Add tests/ to .gitignore to exclude debug scripts
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- .gitignore +4 -1
- YuEGP/inference/infer.py +1 -1
.gitignore
CHANGED
|
@@ -106,4 +106,7 @@ transformers_cache/
|
|
| 106 |
flash_attn/
|
| 107 |
|
| 108 |
# bcakup files
|
| 109 |
-
packages.txt.backup
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
flash_attn/
|
| 107 |
|
| 108 |
# bcakup files
|
| 109 |
+
packages.txt.backup
|
| 110 |
+
|
| 111 |
+
# test files
|
| 112 |
+
tests/
|
YuEGP/inference/infer.py
CHANGED
|
@@ -204,7 +204,7 @@ def encode_audio(codec_model, audio_prompt, device, target_bw=0.5):
|
|
| 204 |
|
| 205 |
|
| 206 |
def split_lyrics(lyrics):
|
| 207 |
-
pattern = r"\[(
|
| 208 |
segments = re.findall(pattern, lyrics, re.DOTALL)
|
| 209 |
structured_lyrics = [f"[{seg[0]}]\n{seg[1].strip()}\n\n" for seg in segments]
|
| 210 |
return structured_lyrics
|
|
|
|
| 204 |
|
| 205 |
|
| 206 |
def split_lyrics(lyrics):
|
| 207 |
+
pattern = r"\[([^]]+)\](.*?)(?=\[|\Z)"
|
| 208 |
segments = re.findall(pattern, lyrics, re.DOTALL)
|
| 209 |
structured_lyrics = [f"[{seg[0]}]\n{seg[1].strip()}\n\n" for seg in segments]
|
| 210 |
return structured_lyrics
|