NVIDIA / NVIDIA/apex

Restoring master_params so model can be saved

Open
#388 5 comments 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,

When training in O2, the model's parameters are cast to fp16 while keeping a copy of the master parameters in the optimizer. I'm wondering how to restore the master parameters so that the model can be saved using the usual model.state_dict() technique, saving fp32 rather than fp16 params.

Thanks!

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 by reviewing O2's optimizer handling of the fp16 model parameters and retained fp32 master parameters, then compare that with the usual model.state_dict() save path. Done means the model can restore or expose fp32 parameters so the standard state_dict() technique saves them instead of fp16 values.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
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.