Spaces:
Running on Zero
Running on Zero
swap torchaudio -> soundfile (avoid libcudart.so.12 load failure)
Browse files- app.py +3 -2
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -72,8 +72,8 @@ _ensure_stable_audio_tools()
|
|
| 72 |
|
| 73 |
|
| 74 |
import gradio as gr
|
|
|
|
| 75 |
import torch
|
| 76 |
-
import torchaudio
|
| 77 |
from einops import rearrange
|
| 78 |
|
| 79 |
from stable_audio_tools import get_pretrained_model
|
|
@@ -216,7 +216,8 @@ def infer(
|
|
| 216 |
output = output[:, : int(duration) * lv.sample_rate]
|
| 217 |
|
| 218 |
out_path = os.path.join(tempfile.mkdtemp(), f"sa3_{variant_key}.wav")
|
| 219 |
-
|
|
|
|
| 220 |
return out_path
|
| 221 |
|
| 222 |
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
import gradio as gr
|
| 75 |
+
import soundfile as sf
|
| 76 |
import torch
|
|
|
|
| 77 |
from einops import rearrange
|
| 78 |
|
| 79 |
from stable_audio_tools import get_pretrained_model
|
|
|
|
| 216 |
output = output[:, : int(duration) * lv.sample_rate]
|
| 217 |
|
| 218 |
out_path = os.path.join(tempfile.mkdtemp(), f"sa3_{variant_key}.wav")
|
| 219 |
+
# soundfile expects (samples, channels); our tensor is (channels, samples).
|
| 220 |
+
sf.write(out_path, output.numpy().T, lv.sample_rate, subtype="PCM_16")
|
| 221 |
return out_path
|
| 222 |
|
| 223 |
|
requirements.txt
CHANGED
|
@@ -3,6 +3,7 @@
|
|
| 3 |
# pre-installed) — its setup.py pulls flash-attn which fails to build in pip's
|
| 4 |
# isolated env. See app.py.
|
| 5 |
einops
|
|
|
|
| 6 |
# PyWavelets 1.7+ ships wheels built for NumPy 2.x; older versions throw a
|
| 7 |
# dtype-size ABI error on the ZeroGPU image.
|
| 8 |
PyWavelets>=1.7.0
|
|
|
|
| 3 |
# pre-installed) — its setup.py pulls flash-attn which fails to build in pip's
|
| 4 |
# isolated env. See app.py.
|
| 5 |
einops
|
| 6 |
+
soundfile
|
| 7 |
# PyWavelets 1.7+ ships wheels built for NumPy 2.x; older versions throw a
|
| 8 |
# dtype-size ABI error on the ZeroGPU image.
|
| 9 |
PyWavelets>=1.7.0
|