Spaces:
Running
Running
fix: forward adapter to synth request, default LM to 1.7B
Browse files
app.py
CHANGED
|
@@ -146,6 +146,8 @@ def _run_pipeline(caption, lyrics, bpm, duration, seed, steps, output_format,
|
|
| 146 |
|
| 147 |
# -- Synth phase --
|
| 148 |
synth_request["output_format"] = synth_fmt
|
|
|
|
|
|
|
| 149 |
if progress_cb:
|
| 150 |
progress_cb("synth_submit", None)
|
| 151 |
r = requests.post(f"{ACE_SERVER}/synth", json=synth_request, timeout=30)
|
|
@@ -179,14 +181,16 @@ def _run_pipeline(caption, lyrics, bpm, duration, seed, steps, output_format,
|
|
| 179 |
# LM model scanning & on-demand download
|
| 180 |
# ---------------------------------------------------------------------------
|
| 181 |
|
|
|
|
|
|
|
| 182 |
AVAILABLE_LM_MODELS = [
|
| 183 |
-
"acestep-5Hz-lm-0.6B-Q8_0.gguf",
|
| 184 |
"acestep-5Hz-lm-1.7B-Q8_0.gguf",
|
|
|
|
| 185 |
"acestep-5Hz-lm-4B-Q5_K_M.gguf",
|
| 186 |
]
|
| 187 |
|
| 188 |
def _scan_lm_models():
|
| 189 |
-
"""Return
|
| 190 |
installed = set()
|
| 191 |
if os.path.isdir(MODELS_DIR):
|
| 192 |
for f in os.listdir(MODELS_DIR):
|
|
@@ -194,11 +198,10 @@ def _scan_lm_models():
|
|
| 194 |
installed.add(f)
|
| 195 |
choices = []
|
| 196 |
for m in AVAILABLE_LM_MODELS:
|
| 197 |
-
label = m.replace(".gguf", "")
|
| 198 |
if m in installed:
|
| 199 |
choices.append(m)
|
| 200 |
else:
|
| 201 |
-
choices.append(f"{m}
|
| 202 |
return choices
|
| 203 |
|
| 204 |
|
|
@@ -385,8 +388,8 @@ def gradio_main():
|
|
| 385 |
|
| 386 |
actual_seed = None if seed is None or int(seed) < 0 else int(seed)
|
| 387 |
adapter = None if lora_select == "None (no LoRA)" else lora_select
|
| 388 |
-
lm_model_file = lm_model_select.replace("
|
| 389 |
-
if lm_model_file and "
|
| 390 |
_download_lm_model(lm_model_file)
|
| 391 |
lm_model = lm_model_file
|
| 392 |
|
|
@@ -661,7 +664,7 @@ def gradio_main():
|
|
| 661 |
)
|
| 662 |
lm_model_select = gr.Dropdown(
|
| 663 |
label="LM Model", choices=_lm_model_choices(),
|
| 664 |
-
value=
|
| 665 |
)
|
| 666 |
|
| 667 |
with gr.Row(elem_classes="compact-row"):
|
|
|
|
| 146 |
|
| 147 |
# -- Synth phase --
|
| 148 |
synth_request["output_format"] = synth_fmt
|
| 149 |
+
if adapter:
|
| 150 |
+
synth_request["adapter"] = adapter
|
| 151 |
if progress_cb:
|
| 152 |
progress_cb("synth_submit", None)
|
| 153 |
r = requests.post(f"{ACE_SERVER}/synth", json=synth_request, timeout=30)
|
|
|
|
| 181 |
# LM model scanning & on-demand download
|
| 182 |
# ---------------------------------------------------------------------------
|
| 183 |
|
| 184 |
+
DEFAULT_LM = "acestep-5Hz-lm-1.7B-Q8_0.gguf"
|
| 185 |
+
|
| 186 |
AVAILABLE_LM_MODELS = [
|
|
|
|
| 187 |
"acestep-5Hz-lm-1.7B-Q8_0.gguf",
|
| 188 |
+
"acestep-5Hz-lm-0.6B-Q8_0.gguf",
|
| 189 |
"acestep-5Hz-lm-4B-Q5_K_M.gguf",
|
| 190 |
]
|
| 191 |
|
| 192 |
def _scan_lm_models():
|
| 193 |
+
"""Return LM model choices. Installed shown as-is, others need download."""
|
| 194 |
installed = set()
|
| 195 |
if os.path.isdir(MODELS_DIR):
|
| 196 |
for f in os.listdir(MODELS_DIR):
|
|
|
|
| 198 |
installed.add(f)
|
| 199 |
choices = []
|
| 200 |
for m in AVAILABLE_LM_MODELS:
|
|
|
|
| 201 |
if m in installed:
|
| 202 |
choices.append(m)
|
| 203 |
else:
|
| 204 |
+
choices.append(f"{m} [not installed]")
|
| 205 |
return choices
|
| 206 |
|
| 207 |
|
|
|
|
| 388 |
|
| 389 |
actual_seed = None if seed is None or int(seed) < 0 else int(seed)
|
| 390 |
adapter = None if lora_select == "None (no LoRA)" else lora_select
|
| 391 |
+
lm_model_file = lm_model_select.replace(" [not installed]", "") if lm_model_select else None
|
| 392 |
+
if lm_model_file and "[not installed]" in (lm_model_select or ""):
|
| 393 |
_download_lm_model(lm_model_file)
|
| 394 |
lm_model = lm_model_file
|
| 395 |
|
|
|
|
| 664 |
)
|
| 665 |
lm_model_select = gr.Dropdown(
|
| 666 |
label="LM Model", choices=_lm_model_choices(),
|
| 667 |
+
value=DEFAULT_LM, scale=1,
|
| 668 |
)
|
| 669 |
|
| 670 |
with gr.Row(elem_classes="compact-row"):
|