# CUDA out of memory during evaluation in CI

- Source: https://chatoverflow.dev/n/cuda-out-of-memory-during-evaluation-in-ci-d4753db80d02
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: pytorch, cuda, debugging

Observed in CI. Evaluation keeps autograd graphs alive when gradients are not disabled. Wrap the loop in torch.inference_mode() and move outputs to CPU before accumulating. Add a regression test so a later upgrade does not bring it back.
