Spaces:
Running on Zero
Running on Zero
Commit ·
00ee17c
1
Parent(s): 9f79da8
Add xregen error logging: try/except in _xregen_dispatch, logging in xregen_mmaudio._run and _mmaudio_gpu_infer to surface GPU worker crashes
Browse files
app.py
CHANGED
|
@@ -1045,6 +1045,7 @@ def _mmaudio_gpu_infer(video_file, prompt, negative_prompt, seed_val,
|
|
| 1045 |
GPU window (ffmpeg is CPU-safe here). This avoids passing pre-extracted
|
| 1046 |
tmp files that don't exist in the GPU worker's process.
|
| 1047 |
"""
|
|
|
|
| 1048 |
_ensure_syspath("MMAudio")
|
| 1049 |
from mmaudio.eval_utils import generate, load_video
|
| 1050 |
from mmaudio.model.flow_matching import FlowMatching
|
|
@@ -1777,12 +1778,21 @@ def _xregen_dispatch(state_json: str, seg_idx: int, slot_id: str, infer_fn):
|
|
| 1777 |
First: (gr.update(), gr.update(value=pending_html)) — shown while GPU runs
|
| 1778 |
Second: (gr.update(value=video_path), gr.update(value=waveform_html))
|
| 1779 |
"""
|
|
|
|
| 1780 |
meta = json.loads(state_json)
|
| 1781 |
pending_html = _build_regen_pending_html(meta["segments"], seg_idx, slot_id, "")
|
| 1782 |
yield gr.update(), gr.update(value=pending_html)
|
| 1783 |
|
| 1784 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1785 |
video_path, waveform_html = _xregen_splice(new_wav_raw, src_sr, meta, seg_idx, slot_id, clip_start_s)
|
|
|
|
| 1786 |
yield gr.update(value=video_path), gr.update(value=waveform_html)
|
| 1787 |
|
| 1788 |
|
|
@@ -1835,12 +1845,14 @@ def xregen_mmaudio(seg_idx, state_json, slot_id,
|
|
| 1835 |
clip_start, clip_end, clip_dur = _xregen_clip_window(meta, seg_idx, MMAUDIO_WINDOW)
|
| 1836 |
source_video = _resolve_silent_video(meta)
|
| 1837 |
sub_segs = _build_segments(clip_dur, MMAUDIO_WINDOW, float(crossfade_s))
|
|
|
|
| 1838 |
# Pass clip_start_s/clip_dur_s so the GPU fn extracts the clip internally —
|
| 1839 |
# pre-extracted tmp files are invisible to the ZeroGPU worker process.
|
| 1840 |
results = _mmaudio_gpu_infer(source_video, prompt, negative_prompt, seed_val,
|
| 1841 |
cfg_strength, num_steps, crossfade_s, crossfade_db, 1,
|
| 1842 |
source_video, json.dumps(sub_segs),
|
| 1843 |
clip_start, clip_dur)
|
|
|
|
| 1844 |
seg_wavs, sr = results[0]
|
| 1845 |
wav = _stitch_wavs(seg_wavs, float(crossfade_s), float(crossfade_db),
|
| 1846 |
clip_dur, sr, sub_segs)
|
|
|
|
| 1045 |
GPU window (ffmpeg is CPU-safe here). This avoids passing pre-extracted
|
| 1046 |
tmp files that don't exist in the GPU worker's process.
|
| 1047 |
"""
|
| 1048 |
+
print(f"[_mmaudio_gpu_infer] START video={video_file!r} silent={silent_video!r} clip_start={clip_start_s} clip_dur={clip_dur_s} num_samples={num_samples}")
|
| 1049 |
_ensure_syspath("MMAudio")
|
| 1050 |
from mmaudio.eval_utils import generate, load_video
|
| 1051 |
from mmaudio.model.flow_matching import FlowMatching
|
|
|
|
| 1778 |
First: (gr.update(), gr.update(value=pending_html)) — shown while GPU runs
|
| 1779 |
Second: (gr.update(value=video_path), gr.update(value=waveform_html))
|
| 1780 |
"""
|
| 1781 |
+
import traceback as _tb
|
| 1782 |
meta = json.loads(state_json)
|
| 1783 |
pending_html = _build_regen_pending_html(meta["segments"], seg_idx, slot_id, "")
|
| 1784 |
yield gr.update(), gr.update(value=pending_html)
|
| 1785 |
|
| 1786 |
+
print(f"[_xregen_dispatch] slot={slot_id} seg={seg_idx} calling infer_fn={infer_fn}")
|
| 1787 |
+
try:
|
| 1788 |
+
new_wav_raw, src_sr, clip_start_s = infer_fn()
|
| 1789 |
+
print(f"[_xregen_dispatch] infer_fn returned wav shape={getattr(new_wav_raw,'shape',None)} sr={src_sr} clip_start={clip_start_s}")
|
| 1790 |
+
except Exception as _e:
|
| 1791 |
+
print(f"[_xregen_dispatch] EXCEPTION in infer_fn: {_e}")
|
| 1792 |
+
_tb.print_exc()
|
| 1793 |
+
raise
|
| 1794 |
video_path, waveform_html = _xregen_splice(new_wav_raw, src_sr, meta, seg_idx, slot_id, clip_start_s)
|
| 1795 |
+
print(f"[_xregen_dispatch] splice done video_path={video_path!r}")
|
| 1796 |
yield gr.update(value=video_path), gr.update(value=waveform_html)
|
| 1797 |
|
| 1798 |
|
|
|
|
| 1845 |
clip_start, clip_end, clip_dur = _xregen_clip_window(meta, seg_idx, MMAUDIO_WINDOW)
|
| 1846 |
source_video = _resolve_silent_video(meta)
|
| 1847 |
sub_segs = _build_segments(clip_dur, MMAUDIO_WINDOW, float(crossfade_s))
|
| 1848 |
+
print(f"[xregen_mmaudio._run] clip_start={clip_start} clip_dur={clip_dur} source_video={source_video!r} sub_segs={sub_segs}")
|
| 1849 |
# Pass clip_start_s/clip_dur_s so the GPU fn extracts the clip internally —
|
| 1850 |
# pre-extracted tmp files are invisible to the ZeroGPU worker process.
|
| 1851 |
results = _mmaudio_gpu_infer(source_video, prompt, negative_prompt, seed_val,
|
| 1852 |
cfg_strength, num_steps, crossfade_s, crossfade_db, 1,
|
| 1853 |
source_video, json.dumps(sub_segs),
|
| 1854 |
clip_start, clip_dur)
|
| 1855 |
+
print(f"[xregen_mmaudio._run] gpu_infer returned {len(results)} results")
|
| 1856 |
seg_wavs, sr = results[0]
|
| 1857 |
wav = _stitch_wavs(seg_wavs, float(crossfade_s), float(crossfade_db),
|
| 1858 |
clip_dur, sr, sub_segs)
|