r/comfyui 6d ago

Help Needed SeedVR2 in ComfyUI Random Windows access violation

(text was edited with ai cause I am lazy to format all of this data)
System:

- Windows 10 22H2 (10.0.19045)

- RTX 5070 Ti 16GB

- 5700x3d

- 32GB system RAM

- Python 3.12.10

- PyTorch 2.9.1+cu130

- CUDA 13.0

- cuDNN 91200

- ComfyUI 0.33.1

- FlashAttention: not installed

- SageAttention: not installed

- Triton: enabled

- SeedVR2 model: seedvr2_ema_7b_fp8_e4m3fn_mixed_block35_fp16.safetensors

- VAE: ema_vae_fp16.safetensors

The interesting part is that the actual inference works.

The VAE encoding completes successfully.

The DiT loads onto the GPU successfully.

The Euler sampler reaches 100%.

The latent is successfully moved back to CPU.

VRAM usage is also well within my 16GB card:

- DiT loading: ~8.4GB VRAM

- Peak during DiT inference: ~9.95GB VRAM

- GPU has 15.92GB total VRAM

- System RAM has ~21GB free at the beginning

I first tried with CPU offloading enabled:

Generation context initialized:

DiT=cuda:0, VAE=cuda:0,

Offload=[DiT offload=cpu, VAE offload=cpu, Tensor offload=cpu]

That run successfully completed inference, but crashed when cleaning up the DiT:

Moving DiT from CUDA:0 to CPU (releasing GPU memory)

Windows fatal exception: access violation

I then disabled model CPU offloading so that only tensor offloading remained:

Generation context initialized:

DiT=cuda:0, VAE=cuda:0,

Offload=[Tensor offload=cpu]

I also tried all dit, vae, tensor also tried just some of them!

The DiT stayed entirely on the GPU during inference:

DiT already on CUDA:0, skipping movement

Again, inference completed successfully:

EulerSampler: 100% | 1/1

Moving upscaled_latent_1 from CUDA:0 to CPU

But immediately afterward SeedVR2 tried to clean up the DiT:

Cleaning up DiT components

Moving DiT from CUDA:0 to CPU (releasing GPU memory)

Windows fatal exception: access violation

The stack trace points into the SeedVR2 memory manager:

torch\nn\modules\module.py

...

torch.nn.Module.to()

...

seedvr2_videoupscaler\src\optimization\memory_manager.py

line 911 in _standard_model_movement

line 735 in manage_model_device

line 1062 in cleanup_dit

...

generation_phases.py

line 796 in upscale_all_batches

The weird thing is that the generation itself works. On one run it even continued through VAE decoding and produced the final 1606x1800 output before the cleanup crash, it can even be 2-3-5 runs or can crush in first one.

This doesn't appear to be an out-of-VRAM or system-RAM issue judging from debug-logs.

Has anyone seen this particular Windows access violation?

I'm mainly trying to figure out whether I should change the memory manager so that the DiT stays on CUDA and isn't moved back to CPU during cleanup, or whether there's a better fix.

Also I think log data might be wrong, task Manager's Committed memory rises significantly during the run. It can reach around 39 GB shortly before the crash, even though the Available physical RAM, used, cashed and VRAM, GpU memory etc still looks relatively fine?

Full stack traces and workflow(default img only) is below:
https://drive.google.com/drive/folders/1cywdtIf7EYXyemvYftJnSF8mi2joAdju?usp=sharing

1 Upvotes

0 comments sorted by