LARC optimizer missing 'state' attribute required by FP16_Optimizer
Open
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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