NVIDIA / NVIDIA/apex

TypeError: LARC is not an Optimizer

Open
#978 3 comments 2 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

optimizer  = torch.optim.SGD(
    model.parameters(),
    lr=args.learning_rate,
    momentum=0.9,
    weight_decay=1e-6,
)
optimizer = LARC(optimizer=optimizer, trust_coefficient=0.001, clip=False)
scheduler = WarmupLinearSchedule(
    optimizer,
    warmup_steps=args.warmup_proportion * num_train_optimization_steps,
    t_total=num_train_optimization_steps,
)    
Traceback (most recent call last):
  File "train.py", line 774, in <module>
    main()
  File "train.py", line 482, in main
    t_total=num_train_optimization_steps,
  File "/mnt/lustre/chenzhiyuan/anaconda3/envs/pt1.5/lib/python3.7/site-packages/pytorch_transformers/optimization.py", line 56, in __init__
    super(WarmupLinearSchedule, self).__init__(optimizer, self.lr_lambda, last_epoch=last_epoch)
  File "/mnt/lustre/chenzhiyuan/anaconda3/envs/pt1.5/lib/python3.7/site-packages/torch/optim/lr_scheduler.py", line 189, in __init__
    super(LambdaLR, self).__init__(optimizer, last_epoch)
  File "/mnt/lustre/chenzhiyuan/anaconda3/envs/pt1.5/lib/python3.7/site-packages/torch/optim/lr_scheduler.py", line 31, in __init__
    type(optimizer).__name__))
TypeError: LARC is not an Optimizer

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 at the optimizer and scheduler setup shown in train.py, then inspect how LARC is passed to WarmupLinearSchedule. Reproduce the TypeError with the provided snippet and determine whether the scheduler can accept LARC; done means the setup initializes without this error and the relevant behavior is covered by a test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.