Spaces:
Sleeping
Sleeping
Update js/app.py
Browse files270 unmodified lines2712722732742752762772782793 unmodified lines283284285286287288289270 unmodified linesjob.progress = 20# ββ 3. Separate (the expensive step) βββββββββββββββββββββββββββββββββββββββ# segment=441000 β 10 s chunks at 44100 Hz. Larger chunks mean# fewer FFT boundary transitions and fewer forward passes overall# while still bounding peak memory to ~2 GB for a 25 MB upload._N_THREADS = max(os.cpu_count() or 2, 2)with torch.no_grad():sources_norm = apply_model(3 unmodified linesprogress=False,split=True,overlap=0.25, # 25 % overlap β accuracy/speed sweet-spotsegment=10.0, # 10 seconds (apply_model expects seconds, not samples)num_workers=0, # no subprocesses on HF Spaces)[0] # drop batch dim: (stems, 2, samples)del wav_norm270 unmodified lines2712722732742752762772782792802812823 unmodified lines286287288289290291270 unmodified linesjob.progress = 20# ββ 3. Separate (the expensive step) βββββββββββββββββββββββββββββββββββββββ# Do NOT pass a custom segment= here. htdemucs_ft's hybrid STFT branch# requires chunks of exactly model.segment (7.8 s = 343,980 samples at# 44100 Hz). Passing a different value (e.g. 10 s = 441,000 samples)# makes the internal overlap-add reshape impossible and crashes with# "shape [1,4,-1,343980] is invalid for input of size β¦".# apply_model reads model.segment automatically when segment= is omitted._N_THREADS = max(os.cpu_count() or 2, 2)with torch.no_grad():sources_norm = apply_model(3 unmodified linesprogress=False,split=True,overlap=0.25, # 25 % overlap β accuracy/speed sweet-spotnum_workers=0, # no subprocesses on HF Spaces)[0] # drop batch dim: (stems, 2, samples)del wav_norm
js/app.py+6-4