Spaces:
Running on Zero
Running on Zero
Vansh Chugh commited on
Commit ·
2be9ef6
1
Parent(s): de6f21d
fix: don't disable autograd, guidance sampling needs it
Browse files
app.py
CHANGED
|
@@ -213,9 +213,14 @@ def build_gap_mask(audio_len, gap_ms, position_ms, sample_rate, device):
|
|
| 213 |
|
| 214 |
|
| 215 |
@spaces.GPU
|
| 216 |
-
@torch.inference_mode()
|
| 217 |
def process_fn(input_audio_path, checkpoint_choice, gap_length_ms, gap_position_ms, steps, guidance_strength):
|
| 218 |
-
"""Fill a gap in the input audio using the selected diffusion model.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
ckpt_cfg = CHECKPOINTS[checkpoint_choice]
|
| 220 |
sample_rate = ckpt_cfg["sample_rate"]
|
| 221 |
audio_len = ckpt_cfg["audio_len"]
|
|
|
|
| 213 |
|
| 214 |
|
| 215 |
@spaces.GPU
|
|
|
|
| 216 |
def process_fn(input_audio_path, checkpoint_choice, gap_length_ms, gap_position_ms, steps, guidance_strength):
|
| 217 |
+
"""Fill a gap in the input audio using the selected diffusion model.
|
| 218 |
+
|
| 219 |
+
Not wrapped in torch.inference_mode(): reconstruction guidance (xi > 0,
|
| 220 |
+
the default) needs torch.autograd.grad() inside the sampler, which
|
| 221 |
+
inference_mode tensors can never support. The sampler applies its own
|
| 222 |
+
torch.no_grad() around the branches that don't need gradients.
|
| 223 |
+
"""
|
| 224 |
ckpt_cfg = CHECKPOINTS[checkpoint_choice]
|
| 225 |
sample_rate = ckpt_cfg["sample_rate"]
|
| 226 |
audio_len = ckpt_cfg["audio_len"]
|