Skip to content

Latest commit

 

History

History
29 lines (19 loc) · 999 Bytes

README.md

File metadata and controls

29 lines (19 loc) · 999 Bytes

l4-pytorch

This is PyTorch implementation of "L4: Practical loss-based stepsize adaptation for deep learning" By Michal Rolínek, Georg Martius.

To install put l4.py to working directory

from l4 import L4

#...

optimizer = optim.SGD(model.parameters(), lr=args.lr, momentum=args.momentum)                                                           | create mode 100644 l4.py                                                                                                                  
# wrap original optimizer with L4
l4opt = L4(optimizer) 

#...

loss = F.nll_loss(output, target)
loss.backward() 

# Comment out original optimizer step
# optimizer.step()

# make step with L4 optimizer, dont forget to pass loss value
l4opt.step(loss)  

Tensorflow implementation can be found here