Skip to content

Optimize realtime silence path and SOLA hot-loop to reduce CPU/GPU overhead#1238

Open
blaisewf wants to merge 1 commit intomainfrom
codex/optimize-realtime-algorithm-for-quality-and-speed-8r1xrd
Open

Optimize realtime silence path and SOLA hot-loop to reduce CPU/GPU overhead#1238
blaisewf wants to merge 1 commit intomainfrom
codex/optimize-realtime-algorithm-for-quality-and-speed-8r1xrd

Conversation

@blaisewf
Copy link
Copy Markdown
Member

Motivation

  • Reduce repeated heavy pipeline runs during silence to lower CPU/GPU usage and reduce wake-up latency spikes in realtime conversion.
  • Remove per-chunk allocations and temporary tensors in the SOLA/crossfade hot path to improve throughput and consistency.

Description

  • Add a throttled keepalive interval controlled via keepalive_ms in **kwargs (default 200 ms) and convert it to keepalive_interval_s, tracking last call with last_keepalive_time.
  • Introduce _run_silence_keepalive(...) helper that centralizes the periodic background pipeline.voice_conversion(...) call and is invoked from VAD and low-volume early-return paths.
  • Cache a device-side silence tensor self._silence_template to avoid allocating zeros on each silent chunk and return it for silent fast-paths.
  • Precompute and reuse sola_norm_kernel and onset_fade_window in VoiceChanger.generate_strength and replace per-request torch.ones(...) and torch.linspace(...) with these cached tensors in the SOLA denominator and onset fade logic.

Testing

  • Ran python -m py_compile rvc/realtime/core.py and it completed successfully.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant