feat: add Wan2.2 S2V (speech-to-video) support - #1925
Open
noctrex wants to merge 1 commit into
Open
Conversation
Audio-driven video generation for Wan2.2-S2V-14B: a reference portrait plus a driving WAV produce a lip-synced video whose output container carries the driving audio. - detect S2V checkpoints by audio-module key presence; uses the wan2.1 VAE - wav2vec2 audio encoder model class, backend module, --audio-encoder flag - S2V modules in the Wan DiT: causal audio encoder, motion encoder, audio injector (AdaLN + cross-attention), reference-latent tokens - audio windowing/bucketing to the latent frame count; uncond uses silence - new --audio flag; mux the driving track into avi/webm (wav sidecar) - skip ComfyUI fp8_scaled .scale_input keys at parse time - docs: downloads, S2V example, sampler and 24 GB VRAM guidance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Audio-driven video generation for Wan2.2-S2V-14B: a reference portrait plus a driving WAV produce a lip-synced video whose output container carries the driving audio.
Additional Information
Verification
wav2vec2 audio encoder parity (vs ComfyUI torch reference):
Per-layer error ratio 0.35-0.94 across layers, max 1.02 at layers 22/23.
Includes the grouped positional conv (weight-norm, drop-last) and stable-LN conv frontend.
A deliberately broken negative control fails the gate (0.547 vs 0.02 tolerance), so the harness is not vacuous.
End-to-end (RX 7900 XTX 24 GB, ROCm,
GGML_HIP_GRAPHS=OFF, 640x368, 13 frames):Note: int8_convrot only works on CUDA out of the box with the current ggml revision.
ROCm and Vulkan support comes from my ggml PRs (leejet/ggml#6-#9, currently open).
The ROCm/Vulkan numbers above were measured with that stack applied. GGUF checkpoints (Q8_0 / Q4_K_M) are unaffected by any of this.
Regression (existing Wan models unchanged):
All report the correct
Version:lines and never detect as S2V.Known limitations
--video-frames, 77-81 frames at 16 fps); long-video chunked extend mode is not implemented yet.GGML_HIP_GRAPHS=OFF(HIP graph capture issue for that graph shape, not specific to this PR's code paths).Sample outputs
77 frames, 512x512, 56.86s/it, ROCm, generate_video completed in 1176.76s
s2v_test_q22_h264.mp4
Checklist
LLM Disclosure: Yes, used GLM-5.3-Flash