Merged
Conversation
MMathisLab
approved these changes
Sep 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds GPU memory usage logging during both training and inference.
It helps users diagnose and prevent out-of-memory (OOM) errors, which have been reported several times (e.g. #2942, #2983). By logging GPU usage per process, users can see how much memory DeepLabCut is reserving without external tools.
Implementation
train.py): GPU usage is appended to log messages at each epoch.Example:
videos.py): GPU usage is shown in tqdm progress bars.Example:
Logged metrics:
torch.cuda.memory_reserved()(per-process reserved memory)torch.cuda.get_device_properties(0).total_memory(total device memory)Why reserved memory?
torch.cuda.memory_allocated()→ actually occupied memory, not reserved buffers.pynvml→ global GPU usage across all processes.nvitopremain better for global monitoring.When CUDA unavailable: logs simply omit GPU usage, still clarifying whether GPU is engaged.