From 32f75791a82dfc5a2296773e55b083fd92806954 Mon Sep 17 00:00:00 2001 From: Djshinshin <129614060+Djshinshin@users.noreply.github.com> Date: Fri, 14 Aug 2026 15:08:29 +0800 Subject: Add batched chunk inference --- MACOS_ARM64.md | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'MACOS_ARM64.md') diff --git a/MACOS_ARM64.md b/MACOS_ARM64.md index bc6c417..dc33865 100644 --- a/MACOS_ARM64.md +++ b/MACOS_ARM64.md @@ -36,14 +36,17 @@ python inference.py \ --in_wav=long_input.wav \ --out_wav=long_output.wav \ --chunk-seconds=6 \ - --overlap-seconds=1 + --overlap-seconds=1 \ + --chunk-batch-size=2 ``` -Only one chunk is transferred to the selected accelerator at a time. The last -chunk is padded for inference and cropped back to its original size; normalized -linear crossfades preserve the exact input frame count. The overlap may be zero -but must not exceed half the chunk duration. Inputs no longer than the requested -chunk use the original full-file path. +`--chunk-batch-size` controls how many chunks are transferred and processed in +one model forward pass. The default of `1` minimizes accelerator memory; larger +values keep memory bounded by a fixed batch but may trade additional memory for +throughput. The last chunk is padded for inference and cropped back to its +original size; normalized linear crossfades preserve the exact input frame +count. The overlap may be zero but must not exceed half the chunk duration. +Inputs no longer than the requested chunk use the original full-file path. If `--checkpoint` is omitted, inference downloads the official `JusperLee/Apollo` `pytorch_model.bin` from Hugging Face. Custom checkpoints @@ -97,6 +100,22 @@ difference `0.7703997492790222`, RMSE `0.027596083317049432`, and correlation from the full-file result were at most `3.3527612686157227e-08`. These objective checks do not establish that the two versions are perceptually equivalent. +The same public 12-second input was also used to compare chunk batch sizes on +MPS. In this Apple M3 run, batching did not improve MPS performance and should +therefore remain an explicit memory/throughput choice rather than a universal +speed claim: + +| Chunk batch size | End-to-end time | Peak memory footprint | +| ---: | ---: | ---: | +| 1 | 11.76 s | 4.65 GiB | +| 2 | 12.28 s | 10.48 GiB | + +Both outputs were float32 PCM, stereo, 44.1 kHz, exactly 12 seconds long, and +finite. Batch sizes 1 and 2 differed by at most `1.04308128356934e-06`, with +RMSE `3.84001256540259e-08` and correlation `0.999999999999966`. CUDA may have +different throughput characteristics, but it was not available for local +hardware validation. + ## Device behavior - `auto` preserves CUDA as the first choice, then selects MPS, then CPU. @@ -124,5 +143,8 @@ checks do not establish that the two versions are perceptually equivalent. can produce a different result from full-file inference. Crossfades reduce boundary discontinuities but do not replace listening tests for seam or musical-consistency artifacts. +- Larger chunk batches can reduce the number of model forward passes but use + more accelerator memory. They are not guaranteed to improve every backend; + the tested MPS configuration was slower with batch size 2. - A successful technical smoke test is not a listening-quality review and does not prove that information missing from a lossy source was truly recovered. -- cgit v1.2.3