NVIDIA / NVIDIA/apex

Out-of-memory when loading the checkpoint w/o setting device id

Open
#756 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9k
Forks
1.5k
Avg merge
2d 4h
Merged PRs (30d)
3

Description

Hi, thanks for sharing this framework! Really easy to use.

Still, I met a problem when I tied to add checkpointing logic. I think the core problem is whether we should specify the device_id when loading checkpoints to cuda memory (in distributed setting).

In the official document we only need to do something like torch.load(ckpt_f)
While in this ImageNet example, it is

torch.load(args.resume, map_location = lambda storage, loc: storage.cuda(args.gpu))

So I am wondering why this is necessary even if I called torch.cuda.set_device(args.gpu) before.

Contributor guide

No contributing guide indexed for this repository

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 with the checkpointing section of the AMP documentation and examples/imagenet/main_amp.py around line 183. Reproduce the distributed checkpoint load using torch.load with and without map_location after torch.cuda.set_device(args.gpu), then trace the resulting device placement and memory use. Done should mean the cause and a supported loading behavior are documented or covered by a focused fix and test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.