# Stonesjtu/pytorch_memlab

Profiling and inspecting memory in pytorch

Repository: https://github.com/Stonesjtu/pytorch_memlab
Canonical: https://ross.abutalabs.com/products/pytorch_memlab
Language: Python
License: MIT
License Family: permissive
Topics: pytorch, cuda-memory, memory-profiler
Last push: 2026-08-12T14:57:59+00:00

## Health v2 (maintenance only)
Score: 94/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 97, release rhythm 87, longevity 100
- inputs: {"age_days": 2658, "days_push": 21, "days_rel": 86, "gap_med": 0, "n_releases_24m": 2}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1077, forks 39 (observed 2026-08-28T04:03:29.703185+00:00)

## What it is
A Python library providing line-level CUDA memory profiling and tensor inspection tools for PyTorch. It helps debug out-of-memory errors by showing per-line memory usage and reporting which tensors occupy GPU memory.

## Use cases
- profile cuda memory usage per line of pytorch code
- debug pytorch out-of-memory errors
- inspect which tensors are occupying gpu memory
- find memory leaks in pytorch training loop
- temporarily move cuda tensors to cpu to free gpu memory
- profile memory usage in jupyter notebook

## When to choose
- debugging CUDA OOM errors in PyTorch models
- you need line-by-line GPU memory attribution like line_profiler
- working in Jupyter/IPython and want %mlrun magic profiling

## When to avoid
- profiling CPU memory or non-PyTorch frameworks
- you need full GPU utilization or speed profiling rather than memory
- working with frameworks other than PyTorch such as TensorFlow or JAX

## Facets
- artifact type: library
- maturity: active
- function: monitoring, benchmarking, developer-tools
- domain: machine-learning, deep-learning, developer-tools, performance
- platform: python, cross-platform
- tags: pytorch, cuda, memory-profiler, profiling, debugging, oom, jupyter, ipython-magic, gpu

## Member repositories
- Stonesjtu/pytorch_memlab (main) score 94

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:29.703185+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:53:13.429644+00:00, confidence not recorded.
  - readme: https://github.com/Stonesjtu/pytorch_memlab (fetched 2026-08-28T04:03:29.703185+00:00, sha 7547d2b9551e)
  - registry_pypi: https://pypi.org/pypi/pytorch_memlab/json (fetched 2026-08-29T12:54:40.732451+00:00, sha c7176e2b1a9b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
