Repository navigation
Description
Git commit
master-1116-bf31b9c (also seen on master-1122-3b12781 for the error-reporting part)
Operating System & Version
Debian 13 in Docker, NVIDIA driver 595.112.07 (CUDA 13.2)
GGML backends
CUDA (RTX A4000, 16 GB). The error-reporting part also on ROCm (Radeon AI PRO R9700).
Command-line arguments used
sd-server --listen-ip 127.0.0.1 --listen-port 8099 \
--model-dir /data/models/gen-models/Comfy-Org--RelayVSR/diffusion_models \
--model-dir /data/models/gen-models/Comfy-Org--RelayVSR/vae \
--max-vram 10.5Weights are relayvsr_x2_lightx2v_int8_convrot.safetensors and relayvsr_flash_vae_x2_fp32.safetensors from Comfy-Org/RelayVSR.
Steps to reproduce
- Start sd-server as above, with the working directory holding
input/A.webm: a Wan2.2 TI2V 5B clip written by sd.cpp itself (832×480, 33 frames, VP8 keyframes, 24 fps). - Post
docs/dgl/relay_vsr/relayvsr-x2-video-upscale.dgltoPOST /sdcpp/v1/dgl/jobs, with only these changes: the two model paths,input_path = "input/A.webm",video::load(input_path)withoutfps_num, and the result saved withmedia::save("output/A.webm", video::encode(..., format = "webm")). - Poll
GET /sdcpp/v1/dgl/jobs/{id}. - Do the same again with
--max-vramleft out.
What you expected to happen
With --max-vram 10.5 the job should run, since without a limit it peaks at 9.3 GiB (nvidia-smi, sampled every 0.5 s). If the budget really can't hold a step, I'd expect it to offload or to fail with an error that says so.
What actually happened
Without --max-vram, the job completes in about 14 s and peaks at 9,493 MiB.
With --max-vram 10.5, it fails after about 3 s, every time:
"error": {"code": "generation_failed", "message": "line 47, column 16: line 36, column 14: diffusion output shape [] does not match input [104, 60, 2, 48, 1]"}The server log has the real reason:
[W] execution engine cannot make enough memory available on CUDA0: need 2747.07 MB device / 6434.13 MB budget, available 5269.56 MB device / 5827.45 MB budget --- execution_engine.cpp:975
[E] RelayVSR Wan segment 31/31 (ggml_runner.final) failed during weight preparation --- execution_engine.cpp:605
So there are two separate problems, I think.
1. The budget plan wants far more than the run uses. At this point the step asks for a 6.4 GB budget while only 5.8 GB of the 10.5 GiB is left, but the whole run with no limit never goes above 9.3 GiB. The budget seems to count weights and runtime in a way that adds up to more than the real peak, so a --max-vram a little above the measured peak isn't enough. As far as I can tell, it doesn't fall back to keeping part of the weights in RAM here, as image and video generation do under --max-vram.
2. A failed weight preparation doesn't fail the job with its reason. The step returns an empty tensor and the script goes on, so the job's error comes from the next line that uses it (diffusion output shape [] does not match input). A client of the DGL job API only sees the log line if it has the server log. The same thing happens with no --max-vram when the card really is too small:
- RelayVSR ×4 at 832×480 on the 16 GB A4000:
need 5425.52 MB device / 11854.77 MB budget, available 2631.56 MB device / unlimited budget,RelayVSR Wan segment 31/31 (ggml_runner.final) failed during weight preparation, and the job error isdiffusion output shape [] does not match input [208, 120, 2, 48, 1]. - SeedVR2 3B,
seedvr2-3b-video-upscale.dglwithwindow_size = 5at 832×480:need 17673.69 MB device / 21061.69 MB budget, available 10951.56 MB device / unlimited budget,SeedVR2 VAE segment 2/17 (seedvr2.vae.encoder.down_blocks.0.resnets.0) failed during weight preparation,vae encode compute failed, and the job error is justline 64, column 16: line 40, column 15: VAE encode failed.
Logs / error messages / stack trace
See above. The full server logs from both runs are available if they help.
Additional context / environment details
I'm running these models from llama-toolchest, which sends its own copies of the upstream example scripts to sd-server's DGL job API. For now it starts video upscaler instances without --max-vram, and it treats the two error texts above as "out of GPU memory". That works, but it's string matching on a message that will probably change.
A related point while I'm here: POST /sdcpp/v1/jobs/{id}/cancel answers 404 for DGL jobs (routes_sdcpp.cpp, the AsyncJobKind::Dgl check), and the DGL routes have no cancel of their own. So the only way to stop a long upscale (a few minutes for 81 frames with SeedVR2) is to stop the server. If cancelling DGL jobs is possible, even only between map iterations, it would help. I can open a separate feature request for that if you prefer.
Otherwise both models work well: RelayVSR ×2/×4 and SeedVR2 3B ran on CUDA and on ROCm (R9700, the tiled window-attention path), with clean joins between RelayVSR windows. Thanks for adding them.
Activity
tmac1973 commentedon Nov 25, 2026
Thank you!
fix(generation): adapt video upscalers to sd.cpp master-1129/1132 (OO…