Accidental Factors

Needless text

Home MITM Categories About

TIL: How to measure memory usage from your PyTorchmodel without running it

· April 22, 2024

(Updated: Nov 24, 2024)

til

Fantastic tip from Alban, particularly useful when you have a giant model and limited VRAM.

The short answer is this 30 lines TorchDispatchMode that tracks all Tensor memory use

https://dev-discuss.pytorch.org/t/how-to-measure-memory-usage-from-your-model-without-running-it/2024