zero.hardware.free_memory¶
- zero.hardware.free_memory()[source]¶
Free GPU-memory occupied by
torch
and run the garbage collector.Warning
There is a small chunk of GPU-memory (occupied by drivers) that is impossible to free. It is a
torch
“limitation”, so the function inherits this property.Inspired by: https://github.com/xtinkt/editable/blob/1c80efb80c196cdb925fc994fc9ed576a246c7a1/lib/utils/basic.py#L124
- Return type