[new] Add the YellowFin optimizer (YFOptimizer) #130
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Add the YellowFin optimizer,called YFOptimizer.
YellowFin is an auto-tuning optimizer based on momentum SGD which requires no manual specification of learning rate and momentum. It measures the objective landscape on-the-fly and tunes momentum as well as learning rate using a local quadratic approximation.
We can use YFOptimizer just like Adam and SGD.
For example:
from fastNLP.core.optimizer import YFOptimizer
trainer = Trainer(model=model, n_epochs=100, optimizer=YFOptimizer(lr=0.01), train_data=train_data, dev_data=dev_data, loss=CrossEntropyLoss(), metrics=AccuracyMetric() )
paper: https://arxiv.org/abs/1706.03471
code: https://github.com/JianGoForIt/YellowFin_Pytorch
Main reason: Add a fancy optimizer, which performs well in many tasks, though has its shortcomings. The biggest advantage is that you can use the default parameters directly, no need to adjust LR manually. (Note: there are also some people say they get a bad performance.)
Checklist 检查下面各项是否完成
Please feel free to remove inapplicable items for your PR.
Changes: 逐项描述修改的内容
Mention: 找人review你的PR
@修改过这个文件的人
@核心开发人员