deepspeedai / deepspeedai/DeepSpeed

Commenting out loss=None causes much higher GPU memory usage in bing_bert.

Open
#547 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

I found that if I comment out loss = None in https://github.com/microsoft/DeepSpeedExamples/blob/fa1d1a71c48623db8a091d9cf636a5fe3b8f43c7/bing_bert/deepspeed_train.py#L176, the GPU memory usage increases significantly. It seems the GPU memory is accumulated with the next batch without manually dereferencing the object but I don't recall that we need this line in pure pytorch training code.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at bing_bert/deepspeed_train.py line 176 and reproduce the GPU memory difference with and without loss = None across batches. Trace the loss object and batch lifecycle to determine why memory is retained, then verify that the training run no longer accumulates GPU memory while preserving its existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.