Spaces:
Running
on
L40S
Running
on
L40S
fix some description
Browse files
LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
Tencent is pleased to support the open source community by making SongGeneration available.
|
2 |
|
3 |
-
Copyright (C) 2025
|
4 |
|
5 |
SongGeneration is licensed under the License Terms of SongGeneration except for the third-party components listed below, which is licensed under different terms. SongGeneration does not impose any additional limitations beyond what is outlined in the respective licenses of these third-party components. Users must comply with all terms and conditions of original licenses of these third-party components and must ensure that the usage of the third party components adheres to all relevant laws and regulations.
|
6 |
|
|
|
1 |
Tencent is pleased to support the open source community by making SongGeneration available.
|
2 |
|
3 |
+
Copyright (C) 2025 Tencent. All rights reserved.
|
4 |
|
5 |
SongGeneration is licensed under the License Terms of SongGeneration except for the third-party components listed below, which is licensed under different terms. SongGeneration does not impose any additional limitations beyond what is outlined in the respective licenses of these third-party components. Users must comply with all terms and conditions of original licenses of these third-party components and must ensure that the usage of the third party components adheres to all relevant laws and regulations.
|
6 |
|
README.md
CHANGED
@@ -26,4 +26,4 @@ Since the model is trained based on data longer than 1 minute, if the given lyri
|
|
26 |
|
27 |
## License
|
28 |
|
29 |
-
The code and weights in this repository is released
|
|
|
26 |
|
27 |
## License
|
28 |
|
29 |
+
The code and weights in this repository is released in the [LICENSE](LICENSE) file.
|
app.py
CHANGED
@@ -61,6 +61,7 @@ def generate_song(lyric, description=None, prompt_audio=None, genre=None, cfg_co
|
|
61 |
global STRUCTS
|
62 |
params = {'cfg_coef':cfg_coef, 'temperature':temperature, 'top_k':top_k}
|
63 |
params = {k:v for k,v in params.items() if v is not None}
|
|
|
64 |
sample_rate = MODEL.cfg.sample_rate
|
65 |
|
66 |
# format lyric
|
@@ -69,12 +70,14 @@ def generate_song(lyric, description=None, prompt_audio=None, genre=None, cfg_co
|
|
69 |
if len(paragraphs) < 1:
|
70 |
return None, json.dumps("Lyrics can not be left blank")
|
71 |
paragraphs_norm = []
|
|
|
72 |
for para in paragraphs:
|
73 |
lines = para.splitlines()
|
74 |
struct_tag = lines[0].strip().lower()
|
75 |
if struct_tag not in STRUCTS:
|
76 |
return None, json.dumps(f"Segments should start with a structure tag in {STRUCTS}")
|
77 |
-
if struct_tag in
|
|
|
78 |
if len(lines) < 2 or not [line.strip() for line in lines[1:] if line.strip()]:
|
79 |
return None, json.dumps("The following segments require lyrics: [verse], [chorus], [bridge]")
|
80 |
else:
|
@@ -88,6 +91,8 @@ def generate_song(lyric, description=None, prompt_audio=None, genre=None, cfg_co
|
|
88 |
else:
|
89 |
new_para_str = struct_tag
|
90 |
paragraphs_norm.append(new_para_str)
|
|
|
|
|
91 |
lyric_norm = " ; ".join(paragraphs_norm)
|
92 |
|
93 |
# format prompt
|
|
|
61 |
global STRUCTS
|
62 |
params = {'cfg_coef':cfg_coef, 'temperature':temperature, 'top_k':top_k}
|
63 |
params = {k:v for k,v in params.items() if v is not None}
|
64 |
+
vocal_structs = ['[verse]', '[chorus]', '[bridge]']
|
65 |
sample_rate = MODEL.cfg.sample_rate
|
66 |
|
67 |
# format lyric
|
|
|
70 |
if len(paragraphs) < 1:
|
71 |
return None, json.dumps("Lyrics can not be left blank")
|
72 |
paragraphs_norm = []
|
73 |
+
vocal_flag = False
|
74 |
for para in paragraphs:
|
75 |
lines = para.splitlines()
|
76 |
struct_tag = lines[0].strip().lower()
|
77 |
if struct_tag not in STRUCTS:
|
78 |
return None, json.dumps(f"Segments should start with a structure tag in {STRUCTS}")
|
79 |
+
if struct_tag in vocal_structs:
|
80 |
+
vocal_flag = True
|
81 |
if len(lines) < 2 or not [line.strip() for line in lines[1:] if line.strip()]:
|
82 |
return None, json.dumps("The following segments require lyrics: [verse], [chorus], [bridge]")
|
83 |
else:
|
|
|
91 |
else:
|
92 |
new_para_str = struct_tag
|
93 |
paragraphs_norm.append(new_para_str)
|
94 |
+
if not vocal_flag:
|
95 |
+
return None, json.dumps(f"The lyric must contain at least one of the following structures: {vocal_structs}")
|
96 |
lyric_norm = " ; ".join(paragraphs_norm)
|
97 |
|
98 |
# format prompt
|
download.py
CHANGED
@@ -2,12 +2,12 @@ from huggingface_hub import snapshot_download
|
|
2 |
import os
|
3 |
|
4 |
def download_model(local_dir):
|
5 |
-
repo_id = "
|
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 |
)
|
|
|
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="de30f7b",
|
11 |
token=os.environ.get("HF_TOKEN"),
|
12 |
ignore_patterns=['.git*']
|
13 |
)
|