From e28b8cd9200d079636502969a855627848cf8109 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Fri, 31 Jan 2025 13:12:59 -0500 Subject: [PATCH] add torch gc debug Signed-off-by: Vladimir Mandic --- modules/devices.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/devices.py b/modules/devices.py index 70fe1271b..4a47644f5 100644 --- a/modules/devices.py +++ b/modules/devices.py @@ -228,6 +228,9 @@ def get_stats(): force = True if reason is None: reason = 'oom' + if debug: + fn = f'{sys._getframe(2).f_code.co_name}:{sys._getframe(1).f_code.co_name}' # pylint: disable=protected-access + log.trace(f'GC: run={force} fast={fast} used={used_gpu} threshold={threshold} fn={fn}') if force: # actual gc collected = gc.collect() if not fast else 0 # python gc