NVIDIA / NVIDIA/apex

LARC optimizer missing 'state' attribute required by FP16_Optimizer

Open
#559 3 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

When I used LARC optimizer and fp16 optimizer as shown in the LARC comments, I got missing AttributeError. After I added optimizer.state to LARC's init() function, the error went away. Can you take a look at this issue? Thanks.

Error:

  File ".../apex/fp16_utils/fp16_optimizer.py", line 143, in __init__
    if param in self.optimizer.state:
AttributeError: 'LARC' object has no attribute 'state'

code I used:

    model = ...
    optim = torch.optim.Adam(model.parameters(), lr=...)
    optim = LARC(optim)
    optim = apex.fp16_utils.FP16_Optimizer(optim)

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 apex/fp16_utils/fp16_optimizer.py at the reported line 143, then inspect LARC.init() and how the optimizer is wrapped in the issue example. Confirm that FP16_Optimizer can use a LARC-wrapped optimizer without the reported AttributeError, with coverage for this wrapping order.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.