Skip to content

Commit

Permalink
add torch gc debug
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Mandic <mandic00@live.com>
  • Loading branch information
vladmandic committed Jan 31, 2025
1 parent 3c06d6b commit e28b8cd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e28b8cd

Please # to comment.