Spaces:
Running
on
L40S
Running
on
L40S
root
commited on
Commit
·
3ef9463
1
Parent(s):
d2ca82a
update full model
Browse files- README.md +432 -16
- app.py +9 -2
- download.py +3 -3
- levo_inference.py +1 -5
- tools/gradio/app.py +3 -1
- tools/gradio/levo_inference.py +1 -5
- tools/gradio/levo_inference_lowmem.py +1 -5
- tools/gradio/run.sh +4 -0
- tools/new_prompt.pt +3 -0
README.md
CHANGED
@@ -1,29 +1,445 @@
|
|
1 |
-
|
2 |
-
title: Song Generation
|
3 |
-
emoji: 🎵
|
4 |
-
colorFrom: purple
|
5 |
-
colorTo: gray
|
6 |
-
sdk: docker
|
7 |
-
app_port: 7860
|
8 |
-
models:
|
9 |
-
- tencent/SongGeneration
|
10 |
-
---
|
11 |
|
|
|
12 |
<p align="center">
|
13 |
-
<a href="https://levo-demo.github.io/">Demo</a> | <a href="https://arxiv.org/abs/2506.07520">Paper</a> | <a href="https://
|
14 |
</p>
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
## Overview
|
18 |
|
19 |
We develop the SongGeneration model. It is an LM-based framework consisting of **LeLM** and a **music codec**. LeLM is capable of parallelly modeling two types of tokens: mixed tokens, which represent the combined audio of vocals and accompaniment to achieve vocal-instrument harmony, and dual-track tokens, which separately encode vocals and accompaniment for high-quality song generation. The music codec reconstructs the dual-track tokens into highfidelity music audio. SongGeneration significantly improves over the open-source music generation models and performs competitively with current state-of-the-art industry systems. For more details, please refer to our [paper](https://arxiv.org/abs/2506.07520).
|
20 |
|
21 |
-
<img src="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
|
|
|
|
|
24 |
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
## License
|
28 |
|
29 |
-
The code and weights in this repository is released in the [LICENSE](LICENSE) file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# SongGeneration
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
<p align="center"><img src="img/logo.jpg" width="40%"></p>
|
4 |
<p align="center">
|
5 |
+
<a href="https://levo-demo.github.io/">Demo</a> | <a href="https://arxiv.org/abs/2506.07520">Paper</a> | <a href="https://huggingface.co/waytan22/SongGeneration">Hugging Face</a> | <a href="https://huggingface.co/spaces/waytan22/SongGeneration-LeVo">Space Demo</a>
|
6 |
</p>
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
This repository is the official repository for “LeVo: High-Quality Song Generation with Multi-Preference Alignment” (NeurIPS 2025). In this repository, we provide the SongGeneration model, inference scripts,pretrained checkpoints, and some music generation tools.
|
11 |
+
|
12 |
+
## News and Updates
|
13 |
+
|
14 |
+
* **2025.10.15🔥**: We have updated the codebase to improve **inference speed** and **generation quality**, and adapted it to the **latest model version**. Please **update to the newest code** to ensure the **best performance and user experience**.
|
15 |
+
* **2025.10.14 🔥**: We have released the **large model (SongGeneration-large)**.
|
16 |
+
* **2025.10.13 🔥**: We have released the **full time model (SongGeneration-base-full)** and **evaluation performance**.
|
17 |
+
* **2025.10.12 🔥**: We have released the **english enhanced model (SongGeneration-base-new)**.
|
18 |
+
* **2025.09.23 🔥**: We have released the [Data Processing Pipeline](https://github.com/tencent-ailab/SongPrep), which is capable of **analyzing the structure and lyrics** of entire songs and **providing precise timestamps** without the need for additional source separation. On the human-annotated test set [SSLD-200](https://huggingface.co/datasets/waytan22/SSLD-200), the model’s performance outperforms mainstream models including Gemini-2.5, Seed-ASR, and Qwen3-ASR.
|
19 |
+
* **2025.07.25 🔥**: SongGeneration can now run with as little as **10GB of GPU memory**.
|
20 |
+
* **2025.07.18 🔥**: SongGeneration now supports generation of **pure music**, **pure vocals**, and **dual-track (vocals + accompaniment separately)** outputs.
|
21 |
+
* **2025.06.16 🔥**: We have released the **SongGeneration** series.
|
22 |
+
|
23 |
+
## TODOs📋
|
24 |
+
|
25 |
+
- [ ] Release SongGeneration-v1.5 (trained on a larger multilingual dataset, supports more languages, and integrates a Reward Model with Reinforcement Learning to enhance musicality and lyric alignment)
|
26 |
+
- [ ] Release finetuning scripts.
|
27 |
+
- [ ] Release Music Codec and VAE.
|
28 |
+
- [x] Release large model.
|
29 |
+
- [x] Release full time model.
|
30 |
+
- [x] Release English enhanced model.
|
31 |
+
- [x] Release data processing pipeline.
|
32 |
+
- [x] Update Low memory usage model.
|
33 |
+
- [x] Support single vocal/bgm track generation.
|
34 |
+
|
35 |
+
## Model Versions
|
36 |
+
|
37 |
+
| Model | Max Length | Language | GPU Menmory | RFT(A100) | Download Link |
|
38 |
+
| ------------------------- | :--------: | :------------------: | :---------: | :-------: | ------------------------------------------------------------ |
|
39 |
+
| SongGeneration-base | 2m30s | zh | 10G/16G | 1.26 | [Huggingface](https://huggingface.co/tencent/SongGeneration/tree/main/ckpt/songgeneration_base) |
|
40 |
+
| SongGeneration-base-new | 2m30s | zh, en | 10G/16G | 1.26 | [Huggingface](https://huggingface.co/lglg666/SongGeneration-base-new) |
|
41 |
+
| SongGeneration-base-full | 4m30s | zh, en | 12G/18G | 1.30 | [Huggingface](https://huggingface.co/lglg666/SongGeneration-base-full) |
|
42 |
+
| SongGeneration-large | 4m30s | zh, en | 22G/28G | 1.51 | [Huggingface](https://huggingface.co/lglg666/SongGeneration-large) |
|
43 |
+
| SongGeneration-v1.5-small | 2m | zh, en, es, ja, etc. | - | - | Coming soon |
|
44 |
+
| SongGeneration-v1.5-base | 4m30s | zh, en, es, ja, etc. | - | - | Coming soon |
|
45 |
+
| SongGeneration-v1.5-large | 4m30s | zh, en, es, ja, etc. | - | - | Coming soon |
|
46 |
+
|
47 |
+
💡 **Notes:**
|
48 |
+
|
49 |
+
- **GPU Memory** — “X / Y” means X: no prompt audio; Y: with prompt audio.
|
50 |
+
- **RFT** — Real Forward Time (pure inference, excluding model loading).
|
51 |
|
52 |
## Overview
|
53 |
|
54 |
We develop the SongGeneration model. It is an LM-based framework consisting of **LeLM** and a **music codec**. LeLM is capable of parallelly modeling two types of tokens: mixed tokens, which represent the combined audio of vocals and accompaniment to achieve vocal-instrument harmony, and dual-track tokens, which separately encode vocals and accompaniment for high-quality song generation. The music codec reconstructs the dual-track tokens into highfidelity music audio. SongGeneration significantly improves over the open-source music generation models and performs competitively with current state-of-the-art industry systems. For more details, please refer to our [paper](https://arxiv.org/abs/2506.07520).
|
55 |
|
56 |
+
<img src="img/over.jpg" alt="img" style="zoom:100%;" />
|
57 |
+
|
58 |
+
## Installation
|
59 |
+
|
60 |
+
### Start from scratch
|
61 |
+
|
62 |
+
You can install the necessary dependencies using the `requirements.txt` file with Python>=3.8.12 and CUDA>=11.8:
|
63 |
+
|
64 |
+
```bash
|
65 |
+
pip install -r requirements.txt
|
66 |
+
pip install -r requirements_nodeps.txt --no-deps
|
67 |
+
```
|
68 |
+
|
69 |
+
**(Optional)** Then install flash attention from git. For example, if you're using Python 3.10 and CUDA 12.0
|
70 |
+
|
71 |
+
```bash
|
72 |
+
pip install https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp310-cp310-linux_x86_64.whl
|
73 |
+
```
|
74 |
+
|
75 |
+
### Start with docker
|
76 |
+
|
77 |
+
```bash
|
78 |
+
docker pull juhayna/song-generation-levo:hf0613
|
79 |
+
docker run -it --gpus all --network=host juhayna/song-generation-levo:hf0613 /bin/bash
|
80 |
+
```
|
81 |
+
|
82 |
+
### Other deploy examples
|
83 |
+
|
84 |
+
- Windows platform with ComfyUI: https://github.com/smthemex/ComfyUI_SongGeneration
|
85 |
+
- Windows installer: http://bilibili.com/video/BV1ATK8zQE8L/?vd_source=22cfc54298226c4161b1aff457d17585
|
86 |
+
- Quick start with ComfyUI on CNB: https://cnb.cool/tencent/tencent-ailab/examples/SongGeneration-comfyui
|
87 |
+
|
88 |
+
## Inference
|
89 |
+
|
90 |
+
To ensure the model runs correctly, **please download all the required folders** from the original source at [Hugging Face](https://huggingface.co/collections/lglg666/levo-68d0c3031c370cbfadade126).
|
91 |
+
|
92 |
+
- Download `ckpt` and `third_party` folder from [Hugging Face](https://huggingface.co/lglg666/SongGeneration-Runtime/tree/main) or [Hugging Face](https://huggingface.co/tencent/SongGeneration/tree/main), and move them into the **root directory** of the project. You can also download models using hugging face-cli.
|
93 |
+
|
94 |
+
```
|
95 |
+
huggingface-cli download lglg666/SongGeneration-Runtime --local-dir ./runtime
|
96 |
+
mv runtime/ckpt ckpt
|
97 |
+
mv runtime/third_party third_party
|
98 |
+
```
|
99 |
+
|
100 |
+
- Download the specific model checkpoint and save it to your specified checkpoint directory: `ckpt_path` (We provide multiple versions of model checkpoints. Please select the most suitable version based on your needs and download the corresponding file. Also, ensure the folder name matches the model version name.) Your can also download models using hugging face-cli.
|
101 |
+
|
102 |
+
```
|
103 |
+
# download SongGeneration-base
|
104 |
+
huggingface-cli download lglg666/SongGeneration-base --local-dir ./songgeneration_base
|
105 |
+
# download SongGeneration-base-new
|
106 |
+
huggingface-cli download lglg666/SongGeneration-base-new --local-dir ./songgeneration_base_new
|
107 |
+
# download SongGeneration-base-full
|
108 |
+
huggingface-cli download lglg666/SongGeneration-base-full --local-dir ./songgeneration_base_full
|
109 |
+
# download SongGeneration-large
|
110 |
+
huggingface-cli download lglg666/SongGeneration-large --local-dir ./songgeneration_large
|
111 |
+
```
|
112 |
+
|
113 |
+
Once everything is set up, you can run the inference script using the following command:
|
114 |
+
|
115 |
+
```bash
|
116 |
+
sh generate.sh ckpt_path lyrics.jsonl output_path
|
117 |
+
```
|
118 |
+
|
119 |
+
- You may provides sample inputs in JSON Lines (`.jsonl`) format. Each line represents an individual song generation request. The model expects each input to contain the following fields:
|
120 |
+
|
121 |
+
- `idx`: A unique identifier for the output song. It will be used as the name of the generated audio file.
|
122 |
+
- `gt_lyric`:The lyrics to be used in generation. It must follow the format of `[Structure] Text`, where `Structure` defines the musical section (e.g., `[Verse]`, `[Chorus]`). See Input Guide.
|
123 |
+
- `descriptions` : (Optional) You may customize the text prompt to guide the model’s generation. This can include attributes like gender, timbre, genre, emotion, instrument, and BPM. See Input Guide.
|
124 |
+
- `prompt_audio_path`: (Optional) Path to a 10-second reference audio file. If provided, the model will generate a new song in a similar style to the given reference.
|
125 |
+
|
126 |
+
- `auto_prompt_audio_type`: (Optional) Used only if `prompt_audio_path` is not provided. This allows the model to automatically select a reference audio from a predefined library based on a given style. Supported values include:
|
127 |
+
- `'Pop'`, `'R&B'`, `'Dance'`, `'Jazz'`, `'Folk'`, `'Rock'`,`'Chinese Style'`, `'Chinese Tradition'`, `'Metal'`, `'Reggae'`, `'Chinese Opera'`, `'Auto'`.
|
128 |
+
- **Note:** If certain optional fields are not required, they can be omitted.
|
129 |
+
|
130 |
+
- Outputs of the loader `output_path`:
|
131 |
+
|
132 |
+
- `audio`: generated audio files
|
133 |
+
- `jsonl`: output jsonls
|
134 |
+
|
135 |
+
- An example command may look like:
|
136 |
+
|
137 |
+
```bash
|
138 |
+
sh generate.sh songgeneration_base sample/lyrics.jsonl sample/output
|
139 |
+
```
|
140 |
+
|
141 |
+
If you encounter **out-of-memory (OOM**) issues, you can manually enable low-memory inference mode using the `--low_mem` flag. For example:
|
142 |
+
|
143 |
+
```bash
|
144 |
+
sh generate.sh ckpt_path lyrics.jsonl output_path --low_mem
|
145 |
+
```
|
146 |
+
|
147 |
+
If your GPU device does **not support Flash Attention** or your environment does **not have Flash Attention installed**, you can disable it by adding the `--not_use_flash_attn` flag. For example:
|
148 |
+
|
149 |
+
```bash
|
150 |
+
sh generate.sh ckpt_path lyrics.jsonl output_path --not_use_flash_attn
|
151 |
+
```
|
152 |
+
|
153 |
+
By default, the model generates **songs with both vocals and accompaniment**. If you want to generate **pure music**, **pure vocals**, or **separated vocal and accompaniment tracks**, please use the following flags:
|
154 |
+
|
155 |
+
- `--bgm` Generate **pure music**
|
156 |
+
- `--vocal` Generate **vocal-only (a cappella)**
|
157 |
+
- `--separate` Generate **separated vocal and accompaniment tracks**
|
158 |
+
|
159 |
+
For example:
|
160 |
|
161 |
+
```bash
|
162 |
+
sh generate.sh ckpt_path lyrics.jsonl output_path --separate
|
163 |
+
```
|
164 |
|
165 |
+
## Input Guide
|
166 |
+
|
167 |
+
An example input file can be found in `sample/lyrics.jsonl`
|
168 |
+
|
169 |
+
### 🎵 Lyrics Input Format
|
170 |
+
|
171 |
+
The `gt_lyric` field defines the lyrics and structure of the song. It consists of multiple musical section, each starting with a structure label. The model uses these labels to guide the musical and lyrical progression of the generated song.
|
172 |
+
|
173 |
+
#### 📌 Structure Labels
|
174 |
+
|
175 |
+
- The following segments **should not** contain lyrics (they are purely instrumental):
|
176 |
+
|
177 |
+
- `[intro-short]`, `[intro-medium]`, `[inst-short]`, `[inst-medium]`, `[outro-short]`, `[outro-medium]`
|
178 |
+
|
179 |
+
> - `short` indicates a segment of approximately 0–10 seconds
|
180 |
+
> - `medium` indicates a segment of approximately 10–20 seconds
|
181 |
+
> - We find that [inst] label is less stable, so we recommend that you do not use it.
|
182 |
+
|
183 |
+
- The following segments **require lyrics**:
|
184 |
+
|
185 |
+
- `[verse]`, `[chorus]`, `[bridge]`
|
186 |
+
|
187 |
+
#### 🧾 Lyrics Formatting Rules
|
188 |
+
|
189 |
+
- Each section is **separated by ` ; `**
|
190 |
+
|
191 |
+
- Within lyrical segments (`[verse]`, `[chorus]`, `[bridge]`), lyrics must be written in complete sentences and separated by a period (`.`)
|
192 |
+
|
193 |
+
- A complete lyric string may look like:
|
194 |
+
|
195 |
+
```
|
196 |
+
[intro-short] ; [verse] These faded memories of us. I can't erase the tears you cried before. Unchained this heart to find its way. My peace won't beg you to stay ; [bridge] If ever your truth still remains. Turn around and see. Life rearranged its games. All these lessons in mistakes. Even years may never erase ; [inst-short] ; [chorus] Like a fool begs for supper. I find myself waiting for her. Only to find the broken pieces of my heart. That was needed for my soul to love again ; [outro-short]
|
197 |
+
```
|
198 |
+
|
199 |
+
- More examples can be found in `sample/test_en_input.jsonl` and `sample/test_zh_input.jsonl`.
|
200 |
+
|
201 |
+
### 📝 Description Input Format
|
202 |
+
|
203 |
+
The `descriptions` field allows you to control various musical attributes of the generated song. It can describe up to six musical dimensions: **Gender** (e.g., male, female), **Timbre** (e.g., dark, bright, soft), **Genre** (e.g., pop, jazz, rock), **Emotion** (e.g., sad, energetic, romantic), **Instrument** (e.g., piano, drums, guitar), **BPM** (e.g., the bpm is 120).
|
204 |
+
|
205 |
+
- All six dimensions are optional — you can specify any subset of them.
|
206 |
+
|
207 |
+
- The order of dimensions is flexible.
|
208 |
+
|
209 |
+
- Use **commas (`,`)** to separate different attributes.
|
210 |
+
|
211 |
+
- Although the model supports open vocabulary, we recommend using predefined tags for more stable and reliable performance. A list of commonly supported tags for each dimension is available in the `sample/description/` folder.
|
212 |
+
|
213 |
+
- Here are a few valid `descriptions` inputs:
|
214 |
+
|
215 |
+
```
|
216 |
+
- female, dark, pop, sad, piano and drums.
|
217 |
+
- male, piano, jazz.
|
218 |
+
- male, dark, the bpm is 110.
|
219 |
+
```
|
220 |
+
|
221 |
+
### 🎧Prompt Audio Usage Notes
|
222 |
+
|
223 |
+
- The input audio file can be longer than 10 seconds, but only the first 10 seconds will be used.
|
224 |
+
- For best musicality and structure, it is recommended to use the chorus section of a song as the prompt audio.
|
225 |
+
- You can use this field to influence genre, instrumentation, rhythm, and voice
|
226 |
+
|
227 |
+
#### ⚠️ Important Considerations
|
228 |
+
|
229 |
+
- **Avoid providing both `prompt_audio_path` and `descriptions` at the same time.**
|
230 |
+
If both are present, and they convey conflicting information, the model may struggle to follow instructions accurately, resulting in degraded generation quality.
|
231 |
+
- If `prompt_audio_path` is not provided, you can instead use `auto_prompt_audio_type` for automatic reference selection.
|
232 |
+
|
233 |
+
## Gradio UI
|
234 |
+
|
235 |
+
You can start up the UI with the following command:
|
236 |
+
|
237 |
+
```bash
|
238 |
+
sh tools/gradio/run.sh ckpt_path
|
239 |
+
```
|
240 |
+
|
241 |
+
## Evaluation Performance
|
242 |
+
|
243 |
+
### Chinese
|
244 |
+
|
245 |
+
<table>
|
246 |
+
<tr>
|
247 |
+
<th rowspan="2">Model</th>
|
248 |
+
<th rowspan="2">Open-Source</th>
|
249 |
+
<th rowspan="2">PER↓</th>
|
250 |
+
<th colspan="4" style="text-align:center;">Audiobox Aesthetics ↑</th>
|
251 |
+
<th colspan="5" style="text-align:center;">SongEval ↑</th>
|
252 |
+
</tr>
|
253 |
+
<tr>
|
254 |
+
<th>CE</th><th>CU</th><th>PC</th><th>PQ</th>
|
255 |
+
<th>COH</th><th>MUS</th><th>MEM</th><th>CLA</th><th>NAT</th>
|
256 |
+
</tr>
|
257 |
+
<tr>
|
258 |
+
<td>Suno</td>
|
259 |
+
<td>❌</td>
|
260 |
+
<td>21.6%</td>
|
261 |
+
<td>7.65</td><td>7.86</td><td>5.94</td><td>8.35</td>
|
262 |
+
<td><b>4.41</b></td><td><b>4.34</b></td><td><b>4.44</b></td><td><b>4.38</b></td><td><b>4.26</b></td>
|
263 |
+
</tr>
|
264 |
+
<tr>
|
265 |
+
<td>Mureka</td>
|
266 |
+
<td>❌</td>
|
267 |
+
<td>7.2%</td>
|
268 |
+
<td>7.71</td><td>7.83</td><td><b>6.39</b></td><td><b>8.44</b></td>
|
269 |
+
<td>4.01</td><td>3.85</td><td>3.73</td><td>3.87</td><td>3.75</td>
|
270 |
+
</tr>
|
271 |
+
<tr>
|
272 |
+
<td>Haimian</td>
|
273 |
+
<td>❌</td>
|
274 |
+
<td>11.8%</td>
|
275 |
+
<td>7.56</td><td>7.85</td><td>5.89</td><td>8.27</td>
|
276 |
+
<td>3.69</td><td>3.43</td><td>3.51</td><td>3.52</td><td>3.34</td>
|
277 |
+
</tr>
|
278 |
+
<tr>
|
279 |
+
<td>ACE-Step</td>
|
280 |
+
<td>✅</td>
|
281 |
+
<td>37.1%</td>
|
282 |
+
<td>7.37</td><td>7.52</td><td><b>6.26</b></td><td>7.85</td>
|
283 |
+
<td>3.68</td><td>3.45</td><td>3.54</td><td>3.48</td><td>3.38</td>
|
284 |
+
</tr>
|
285 |
+
<tr>
|
286 |
+
<td>Diffrhythm-v1,2</td>
|
287 |
+
<td>✅</td>
|
288 |
+
<td>8.78%</td>
|
289 |
+
<td>6.91</td><td>7.45</td><td>5.45</td><td>7.99</td>
|
290 |
+
<td>2.93</td><td>2.60</td><td>2.70</td><td>2.71</td><td>2.60</td>
|
291 |
+
</tr>
|
292 |
+
<tr>
|
293 |
+
<td>YUE</td>
|
294 |
+
<td>✅</td>
|
295 |
+
<td>14.9%</td>
|
296 |
+
<td>7.29</td><td>7.53</td><td>6.19</td><td>7.96</td>
|
297 |
+
<td>3.68</td><td>3.43</td><td>3.49</td><td>3.49</td><td>3.42</td>
|
298 |
+
</tr>
|
299 |
+
<tr>
|
300 |
+
<td>SongGeneration-base</td>
|
301 |
+
<td>✅</td>
|
302 |
+
<td>7.2%</td>
|
303 |
+
<td>7.78</td><td>7.90</td><td>6.03</td><td>8.42</td>
|
304 |
+
<td>3.96</td><td>3.80</td><td>3.85</td><td>3.74</td><td>3.71</td>
|
305 |
+
</tr>
|
306 |
+
<tr>
|
307 |
+
<td>SongGeneration-base-new</td>
|
308 |
+
<td>✅</td>
|
309 |
+
<td><b>5.7%</b></td>
|
310 |
+
<td><b>7.82</b></td><td><b>7.94</b></td><td>6.07</td><td>8.43</td>
|
311 |
+
<td>4.07</td><td>3.92</td><td>3.98</td><td>3.93</td><td>3.86</td>
|
312 |
+
</tr>
|
313 |
+
<tr>
|
314 |
+
<td>SongGeneration-base-full</td>
|
315 |
+
<td>✅</td>
|
316 |
+
<td>8.4%</td>
|
317 |
+
<td><b>7.81</b></td><td><b>7.94</b></td><td>6.07</td><td>8.41</td>
|
318 |
+
<td>4.02</td><td>3.88</td><td>3.94</td><td>3.87</td><td>3.80</td>
|
319 |
+
</tr>
|
320 |
+
<tr>
|
321 |
+
<td>SongGeneration-large</td>
|
322 |
+
<td>✅</td>
|
323 |
+
<td><b>5.1%</b></td>
|
324 |
+
<td><b>7.82</b></td><td><b>7.95</b></td><td>6.09</td><td><b>8.46</b></td>
|
325 |
+
<td><b>4.08</b></td><td><b>3.94</b></td><td><b>4.00</b></td><td><b>3.94</b></td><td><b>3.87</b></td>
|
326 |
+
</tr>
|
327 |
+
</table>
|
328 |
+
|
329 |
+
### English
|
330 |
+
|
331 |
+
<table>
|
332 |
+
<tr>
|
333 |
+
<th rowspan="2">Model</th>
|
334 |
+
<th rowspan="2">Open-Source</th>
|
335 |
+
<th rowspan="2">PER↓</th>
|
336 |
+
<th colspan="4" style="text-align:center;">Audiobox Aesthetics ↑</th>
|
337 |
+
<th colspan="5" style="text-align:center;">SongEval ↑</th>
|
338 |
+
</tr>
|
339 |
+
<tr>
|
340 |
+
<th>CE</th><th>CU</th><th>PC</th><th>PQ</th>
|
341 |
+
<th>COH</th><th>MUS</th><th>MEM</th><th>CLA</th><th>NAT</th>
|
342 |
+
</tr>
|
343 |
+
<tr>
|
344 |
+
<td>Suno</td>
|
345 |
+
<td>❌</td>
|
346 |
+
<td>15.6%</td>
|
347 |
+
<td>7.64</td><td>7.85</td><td>5.84</td><td>8.19</td>
|
348 |
+
<td><b>4.49</b></td><td><b>4.35</b></td><td><b>4.47</b></td><td><b>4.35</b></td><td><b>4.23</b></td>
|
349 |
+
</tr>
|
350 |
+
<tr>
|
351 |
+
<td>Mureka</td>
|
352 |
+
<td>❌</td>
|
353 |
+
<td><b>12.6%</b></td>
|
354 |
+
<td>7.71</td><td>7.93</td><td><b>6.46</b></td><td>8.39</td>
|
355 |
+
<td>4.06</td><td>3.88</td><td>3.90</td><td>3.90</td><td>3.73</td>
|
356 |
+
</tr>
|
357 |
+
<tr>
|
358 |
+
<td>Haimian</td>
|
359 |
+
<td>❌</td>
|
360 |
+
<td>26.6%</td>
|
361 |
+
<td><b>7.85</b></td><td><b>8.01</b></td><td>5.28</td><td><b>8.44</b></td>
|
362 |
+
<td>3.83</td><td>3.68</td><td>3.71</td><td>3.61</td><td>3.45</td>
|
363 |
+
</tr>
|
364 |
+
<tr>
|
365 |
+
<td>ACE-Step</td>
|
366 |
+
<td>✅</td>
|
367 |
+
<td>32.1%</td>
|
368 |
+
<td>7.19</td><td>7.37</td><td>6.16</td><td>7.57</td>
|
369 |
+
<td>3.59</td><td>3.34</td><td>3.43</td><td>3.36</td><td>3.27</td>
|
370 |
+
</tr>
|
371 |
+
<tr>
|
372 |
+
<td>Diffrhythm-v1.2</td>
|
373 |
+
<td>✅</td>
|
374 |
+
<td>17.8%</td>
|
375 |
+
<td>7.02</td><td>7.58</td><td>5.96</td><td>7.81</td>
|
376 |
+
<td>3.51</td><td>3.12</td><td>3.32</td><td>3.21</td><td>3.08</td>
|
377 |
+
</tr>
|
378 |
+
<tr>
|
379 |
+
<td>YUE</td>
|
380 |
+
<td>✅</td>
|
381 |
+
<td>27.3%</td>
|
382 |
+
<td>7.04</td><td>7.22</td><td>5.89</td><td>7.67</td>
|
383 |
+
<td>3.58</td><td>3.24</td><td>3.42</td><td>3.37</td><td>3.30</td>
|
384 |
+
</tr>
|
385 |
+
<tr>
|
386 |
+
<td>SongGeneration-base</td>
|
387 |
+
<td>✅</td>
|
388 |
+
<td>-</td>
|
389 |
+
<td>-</td><td>-</td><td>-</td><td>-</td>
|
390 |
+
<td>-</td><td>-</td><td>-</td><td>-</td><td>-</td>
|
391 |
+
</tr>
|
392 |
+
<tr>
|
393 |
+
<td>SongGeneration-base-new</td>
|
394 |
+
<td>✅</td>
|
395 |
+
<td>16.2%</td>
|
396 |
+
<td><b>7.78</b></td><td>7.97</td><td>6.03</td><td>8.37</td>
|
397 |
+
<td>4.05</td><td>3.90</td><td>3.99</td><td>3.91</td><td>3.79</td>
|
398 |
+
</tr>
|
399 |
+
<tr>
|
400 |
+
<td>SongGeneration-base-full</td>
|
401 |
+
<td>✅</td>
|
402 |
+
<td>20.1%</td>
|
403 |
+
<td>7.76</td><td>7.98</td><td>5.96</td><td>8.39</td>
|
404 |
+
<td>4.02</td><td>3.87</td><td>3.97</td><td>3.86</td><td>3.74</td>
|
405 |
+
</tr>
|
406 |
+
<tr>
|
407 |
+
<td>SongGeneration-large</td>
|
408 |
+
<td>✅</td>
|
409 |
+
<td><b>14.9%</b></td>
|
410 |
+
<td><b>7.85</b></td><td><b>8.05</b></td><td><b>6.17</b></td><td><b>8.46</b></td>
|
411 |
+
<td><b>4.08</b></td><td><b>3.94</b></td><td><b>4.03</b></td><td><b>3.93</b></td><td><b>3.82</b></td>
|
412 |
+
</tr>
|
413 |
+
</table>
|
414 |
+
|
415 |
+
### Notes
|
416 |
+
|
417 |
+
1. The evaluation results of SongGeneration are based on **200 generated songs**, including **100 using descriptions** and **100 using `auto_prompt_audio_type=Auto`**. We also provide **40 English** and **40 Chinese** example inputs in
|
418 |
+
`sample/test_en_input.jsonl` and `sample/test_zh_input.jsonl` for reference.
|
419 |
+
2. Since the model attempts to clone the timbre and musical style of the given prompt audio, the choice of prompt audio can significantly affect generation performance, and may lead to fluctuations in the evaluation metrics.
|
420 |
+
3. The format of the input lyrics has a strong impact on generation quality. If the output quality appears suboptimal, please check whether your lyrics format is correct. You can find more examples of properly formatted inputs in `sample/test_en_input.jsonl` and `sample/test_zh_input.jsonl`.
|
421 |
+
|
422 |
+
## Citation
|
423 |
+
|
424 |
+
```
|
425 |
+
@article{lei2025levo,
|
426 |
+
title={LeVo: High-Quality Song Generation with Multi-Preference Alignment},
|
427 |
+
author={Lei, Shun and Xu, Yaoxun and Lin, Zhiwei and Zhang, Huaicheng and Tan, Wei and Chen, Hangting and Yu, Jianwei and Zhang, Yixuan and Yang, Chenyu and Zhu, Haina and Wang, Shuai and Wu, Zhiyong and Yu, Dong},
|
428 |
+
journal={arXiv preprint arXiv:2506.07520},
|
429 |
+
year={2025}
|
430 |
+
}
|
431 |
+
```
|
432 |
|
433 |
## License
|
434 |
|
435 |
+
The code and weights in this repository is released in the [LICENSE](LICENSE) file.
|
436 |
+
|
437 |
+
|
438 |
+
## Contact
|
439 |
+
|
440 |
+
Use WeChat or QQ to scan blow QR code.
|
441 |
+
|
442 |
+
<div style="display: flex; justify-content: center; gap: 20px; width: 100%;">
|
443 |
+
<img src="img/contact.png" height="300" />
|
444 |
+
<img src="img/contactQQ.jpg" height="300" />
|
445 |
+
</div>
|
app.py
CHANGED
@@ -4,17 +4,23 @@ from datetime import datetime
|
|
4 |
import yaml
|
5 |
import time
|
6 |
import re
|
|
|
7 |
import os.path as op
|
|
|
8 |
from download import download_model
|
|
|
9 |
# 下载模型
|
10 |
APP_DIR = op.dirname(op.abspath(__file__))
|
11 |
download_model(APP_DIR)
|
|
|
|
|
|
|
12 |
print("Successful downloaded model.")
|
13 |
|
14 |
from levo_inference import LeVoInference
|
15 |
|
16 |
# 模型初始化
|
17 |
-
MODEL = LeVoInference(
|
18 |
|
19 |
EXAMPLE_LYRICS = """
|
20 |
[intro-short]
|
@@ -105,7 +111,7 @@ def generate_song(lyric, description=None, prompt_audio=None, genre=None, cfg_co
|
|
105 |
progress(0.0, "Start Generation")
|
106 |
start = time.time()
|
107 |
|
108 |
-
audio_data = MODEL(lyric_norm, description, prompt_audio, genre, op.join(APP_DIR, "
|
109 |
|
110 |
end = time.time()
|
111 |
|
@@ -246,5 +252,6 @@ lyrics
|
|
246 |
|
247 |
# 启动应用
|
248 |
if __name__ == "__main__":
|
|
|
249 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
250 |
|
|
|
4 |
import yaml
|
5 |
import time
|
6 |
import re
|
7 |
+
import os
|
8 |
import os.path as op
|
9 |
+
import torch
|
10 |
from download import download_model
|
11 |
+
|
12 |
# 下载模型
|
13 |
APP_DIR = op.dirname(op.abspath(__file__))
|
14 |
download_model(APP_DIR)
|
15 |
+
base_full_path = op.join(APP_DIR, "ckpt", "songgeneration_base_full")
|
16 |
+
os.makedirs(base_full_path, exist_ok=True)
|
17 |
+
download_model(base_full_path, repo_id="lglg666/SongGeneration-base-full", revision="19ebdb6")
|
18 |
print("Successful downloaded model.")
|
19 |
|
20 |
from levo_inference import LeVoInference
|
21 |
|
22 |
# 模型初始化
|
23 |
+
MODEL = LeVoInference(base_full_path)
|
24 |
|
25 |
EXAMPLE_LYRICS = """
|
26 |
[intro-short]
|
|
|
111 |
progress(0.0, "Start Generation")
|
112 |
start = time.time()
|
113 |
|
114 |
+
audio_data = MODEL(lyric_norm, description, prompt_audio, genre, op.join(APP_DIR, "tools/new_prompt.pt"), gen_type, params).cpu().permute(1, 0).float().numpy()
|
115 |
|
116 |
end = time.time()
|
117 |
|
|
|
252 |
|
253 |
# 启动应用
|
254 |
if __name__ == "__main__":
|
255 |
+
torch.set_num_threads(1)
|
256 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
257 |
|
download.py
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
from huggingface_hub import snapshot_download
|
2 |
import os
|
3 |
|
4 |
-
def download_model(local_dir):
|
5 |
-
repo_id = "tencent/SongGeneration"
|
6 |
|
|
|
7 |
downloaded_path = snapshot_download(
|
8 |
repo_id=repo_id,
|
9 |
local_dir=local_dir,
|
10 |
-
revision=
|
11 |
token=os.environ.get("HF_TOKEN"),
|
12 |
ignore_patterns=['.git*']
|
13 |
)
|
14 |
print(f"File downloaded to:{downloaded_path}")
|
15 |
|
|
|
16 |
if __name__ == '__main__':
|
17 |
download_model('.')
|
|
|
1 |
from huggingface_hub import snapshot_download
|
2 |
import os
|
3 |
|
|
|
|
|
4 |
|
5 |
+
def download_model(local_dir, repo_id="tencent/SongGeneration", revision="647f0a5"):
|
6 |
downloaded_path = snapshot_download(
|
7 |
repo_id=repo_id,
|
8 |
local_dir=local_dir,
|
9 |
+
revision=revision,
|
10 |
token=os.environ.get("HF_TOKEN"),
|
11 |
ignore_patterns=['.git*']
|
12 |
)
|
13 |
print(f"File downloaded to:{downloaded_path}")
|
14 |
|
15 |
+
|
16 |
if __name__ == '__main__':
|
17 |
download_model('.')
|
levo_inference.py
CHANGED
@@ -76,11 +76,7 @@ class LeVoInference(torch.nn.Module):
|
|
76 |
melody_is_wav = True
|
77 |
elif genre is not None and auto_prompt_path is not None:
|
78 |
auto_prompt = torch.load(auto_prompt_path)
|
79 |
-
|
80 |
-
if genre == "Auto":
|
81 |
-
prompt_token = merge_prompt[np.random.randint(0, len(merge_prompt))]
|
82 |
-
else:
|
83 |
-
prompt_token = auto_prompt[genre][np.random.randint(0, len(auto_prompt[genre]))]
|
84 |
pmt_wav = prompt_token[:,[0],:]
|
85 |
vocal_wav = prompt_token[:,[1],:]
|
86 |
bgm_wav = prompt_token[:,[2],:]
|
|
|
76 |
melody_is_wav = True
|
77 |
elif genre is not None and auto_prompt_path is not None:
|
78 |
auto_prompt = torch.load(auto_prompt_path)
|
79 |
+
prompt_token = auto_prompt[genre][np.random.randint(0, len(auto_prompt[genre]))]
|
|
|
|
|
|
|
|
|
80 |
pmt_wav = prompt_token[:,[0],:]
|
81 |
vocal_wav = prompt_token[:,[1],:]
|
82 |
bgm_wav = prompt_token[:,[2],:]
|
tools/gradio/app.py
CHANGED
@@ -6,6 +6,7 @@ import yaml
|
|
6 |
import time
|
7 |
import re
|
8 |
import os.path as op
|
|
|
9 |
from levo_inference_lowmem import LeVoInference
|
10 |
|
11 |
EXAMPLE_LYRICS = """
|
@@ -98,7 +99,7 @@ def generate_song(lyric, description=None, prompt_audio=None, genre=None, cfg_co
|
|
98 |
progress(0.0, "Start Generation")
|
99 |
start = time.time()
|
100 |
|
101 |
-
audio_data = MODEL(lyric_norm, description, prompt_audio, genre, op.join(APP_DIR, "
|
102 |
|
103 |
end = time.time()
|
104 |
|
@@ -239,4 +240,5 @@ lyrics
|
|
239 |
|
240 |
# 启动应用
|
241 |
if __name__ == "__main__":
|
|
|
242 |
demo.launch(server_name="0.0.0.0", server_port=8081)
|
|
|
6 |
import time
|
7 |
import re
|
8 |
import os.path as op
|
9 |
+
import torch
|
10 |
from levo_inference_lowmem import LeVoInference
|
11 |
|
12 |
EXAMPLE_LYRICS = """
|
|
|
99 |
progress(0.0, "Start Generation")
|
100 |
start = time.time()
|
101 |
|
102 |
+
audio_data = MODEL(lyric_norm, description, prompt_audio, genre, op.join(APP_DIR, "tools/new_prompt.pt"), gen_type, params).cpu().permute(1, 0).float().numpy()
|
103 |
|
104 |
end = time.time()
|
105 |
|
|
|
240 |
|
241 |
# 启动应用
|
242 |
if __name__ == "__main__":
|
243 |
+
torch.set_num_threads(1)
|
244 |
demo.launch(server_name="0.0.0.0", server_port=8081)
|
tools/gradio/levo_inference.py
CHANGED
@@ -71,11 +71,7 @@ class LeVoInference(torch.nn.Module):
|
|
71 |
melody_is_wav = True
|
72 |
elif genre is not None and auto_prompt_path is not None:
|
73 |
auto_prompt = torch.load(auto_prompt_path)
|
74 |
-
|
75 |
-
if genre == "Auto":
|
76 |
-
prompt_token = merge_prompt[np.random.randint(0, len(merge_prompt))]
|
77 |
-
else:
|
78 |
-
prompt_token = auto_prompt[genre][np.random.randint(0, len(auto_prompt[genre]))]
|
79 |
pmt_wav = prompt_token[:,[0],:]
|
80 |
vocal_wav = prompt_token[:,[1],:]
|
81 |
bgm_wav = prompt_token[:,[2],:]
|
|
|
71 |
melody_is_wav = True
|
72 |
elif genre is not None and auto_prompt_path is not None:
|
73 |
auto_prompt = torch.load(auto_prompt_path)
|
74 |
+
prompt_token = auto_prompt[genre][np.random.randint(0, len(auto_prompt[genre]))]
|
|
|
|
|
|
|
|
|
75 |
pmt_wav = prompt_token[:,[0],:]
|
76 |
vocal_wav = prompt_token[:,[1],:]
|
77 |
bgm_wav = prompt_token[:,[2],:]
|
tools/gradio/levo_inference_lowmem.py
CHANGED
@@ -66,11 +66,7 @@ class LeVoInference(torch.nn.Module):
|
|
66 |
torch.cuda.empty_cache()
|
67 |
elif genre is not None and auto_prompt_path is not None:
|
68 |
auto_prompt = torch.load(auto_prompt_path)
|
69 |
-
|
70 |
-
if genre == "Auto":
|
71 |
-
prompt_token = merge_prompt[np.random.randint(0, len(merge_prompt))]
|
72 |
-
else:
|
73 |
-
prompt_token = auto_prompt[genre][np.random.randint(0, len(auto_prompt[genre]))]
|
74 |
pmt_wav = prompt_token[:,[0],:]
|
75 |
vocal_wav = prompt_token[:,[1],:]
|
76 |
bgm_wav = prompt_token[:,[2],:]
|
|
|
66 |
torch.cuda.empty_cache()
|
67 |
elif genre is not None and auto_prompt_path is not None:
|
68 |
auto_prompt = torch.load(auto_prompt_path)
|
69 |
+
prompt_token = auto_prompt[genre][np.random.randint(0, len(auto_prompt[genre]))]
|
|
|
|
|
|
|
|
|
70 |
pmt_wav = prompt_token[:,[0],:]
|
71 |
vocal_wav = prompt_token[:,[1],:]
|
72 |
bgm_wav = prompt_token[:,[2],:]
|
tools/gradio/run.sh
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
export USER=root
|
2 |
export PYTHONDONTWRITEBYTECODE=1
|
3 |
export TRANSFORMERS_CACHE="$(pwd)/third_party/hub"
|
|
|
1 |
+
export OMP_NUM_THREADS=1
|
2 |
+
export MKL_NUM_THREADS=1
|
3 |
+
export CUDA_LAUNCH_BLOCKING=0
|
4 |
+
|
5 |
export USER=root
|
6 |
export PYTHONDONTWRITEBYTECODE=1
|
7 |
export TRANSFORMERS_CACHE="$(pwd)/third_party/hub"
|
tools/new_prompt.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:db5490d73565f95047fa826cd43d2e1416f3b15e61bebd57c193813b752cb988
|
3 |
+
size 2102124
|