MCPcopy Index your code
hub / github.com/huggingface/diffusers / get_memory_consumption_stat

Function get_memory_consumption_stat

tests/quantization/utils.py:39–45  ·  view source on GitHub ↗
(model, inputs)

Source from the content-addressed store, hash-verified

37 @torch.no_grad()
38 @torch.inference_mode()
39 def get_memory_consumption_stat(model, inputs):
40 backend_reset_peak_memory_stats(torch_device)
41 backend_empty_cache(torch_device)
42
43 model(**inputs)
44 max_mem_allocated = backend_max_memory_allocated(torch_device)
45 return max_mem_allocated

Calls 3

backend_empty_cacheFunction · 0.50

Tested by 5

Used in the wild real call sites across dependent graphs

searching dependent graphs…