Commit Graph

2 Commits

Author SHA1 Message Date
Sean Naren 065cc94112
Fix bug comparing max_steps to global step which inits at 0 (#4278)
* Fix bug comparing max_steps to global step which inits at 0

* Added test to ensure accumulate grad batch works with max steps

* check fix with TODO test

* correct call counts

* Add check to ensure we've finished accumulation of this global step before exiting loop in conjuction with max steps

* Remove + 1 check in test as this was incorrect

* Update incorrect expected outputs in lr finder test

* Added brackets for clarity

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
2020-10-22 13:58:59 +01:00
Justus Schock 0ec4107697
Optimizer closure (#4190)
* closure for all optimizers

* rename hook and take care of alternating backwards

* add comment

* training_loop_fix

* closure whenever possible

* training_loop

* simple tests that count backward calls

* fix test to work with closure

* remove debugging statement

* better place

* check grads after backward

* start fixing manual optimization

* skip step when result returned by closure was None

* fix gradient clipping test to work with closure

* attribute dict result only for automatic optimization

* adjust backward calls in accelerator

* adjust where to call gradient clipping

* adjust backward calls in tests

* Apply suggestions from code review

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* pass kwargs to xla optimizer

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
2020-10-21 19:34:29 +01:00