Spaces:
Running on Zero
Running on Zero
Fetch the LoRA pinned in the worker and hand the pipeline its path, rather than downloading it inside the GPU call.
Browse files
app.py
CHANGED
|
@@ -20,6 +20,15 @@ from pipeline_ace_step import ACEStepPipeline
|
|
| 20 |
CHECKPOINT_DIR = snapshot_download("ACE-Step/ACE-Step-v1-3.5B",
|
| 21 |
revision="82cd0d7b6322bd28cd4e830fe675ddb6180ce36c")
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
# Construction only records where the weights are. They load on the first call, inside the GPU
|
| 24 |
# reservation, which is how the authors' Space runs it as well.
|
| 25 |
pipeline = ACEStepPipeline(
|
|
@@ -75,7 +84,7 @@ def process_fn(audio_duration, prompt, lyrics, infer_step, guidance_scale, omega
|
|
| 75 |
audio2audio_enable=audio2audio_enable,
|
| 76 |
ref_audio_strength=ref_audio_strength,
|
| 77 |
ref_audio_input=ref_audio_input,
|
| 78 |
-
lora_name_or_path=lora_name_or_path,
|
| 79 |
save_path=tempfile.mkdtemp(),
|
| 80 |
)
|
| 81 |
|
|
|
|
| 20 |
CHECKPOINT_DIR = snapshot_download("ACE-Step/ACE-Step-v1-3.5B",
|
| 21 |
revision="82cd0d7b6322bd28cd4e830fe675ddb6180ce36c")
|
| 22 |
|
| 23 |
+
# The LoRA the interface offers, fetched pinned in the worker, which runs process_fn, rather than
|
| 24 |
+
# inside the GPU call the first time a request picks it. The pipeline is handed its local path,
|
| 25 |
+
# which it loads as it is.
|
| 26 |
+
LORAS = {}
|
| 27 |
+
if __name__ != "__main__":
|
| 28 |
+
LORAS["ACE-Step/ACE-Step-v1-chinese-rap-LoRA"] = snapshot_download(
|
| 29 |
+
"ACE-Step/ACE-Step-v1-chinese-rap-LoRA", revision="e40a223cb69a60ba8a8c46752987c152b8a5f828"
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
# Construction only records where the weights are. They load on the first call, inside the GPU
|
| 33 |
# reservation, which is how the authors' Space runs it as well.
|
| 34 |
pipeline = ACEStepPipeline(
|
|
|
|
| 84 |
audio2audio_enable=audio2audio_enable,
|
| 85 |
ref_audio_strength=ref_audio_strength,
|
| 86 |
ref_audio_input=ref_audio_input,
|
| 87 |
+
lora_name_or_path=LORAS.get(lora_name_or_path, lora_name_or_path),
|
| 88 |
save_path=tempfile.mkdtemp(),
|
| 89 |
)
|
| 90 |
|