Skip to content

bojone/keras_lazyoptimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Keras Implement of Lazy Optimizer

Inheriting Optimizer class, wrapping the original optimizer to achieve a new corresponding lazy optimizer.

Here we use gradients are equal to zeros or not to distinguish whether the words are sampled or not.

Usage

just replace your original with-momentum optimizer, like Adam(1e-3), with LazyOptimizer(Adam(1e-3), embedding_layers).

see imdb_lstm_test.py.

Lazy类优化器的Keras实现

继承Optimizer类,包装原有优化器,实现Lazy版优化器。

这里判断一个词是否被采样的方法是检查该词的梯度是否全为0。

用法

直接将原来用的带动量的优化器, 如 Adam(1e-3), 替换为 LazyOptimizer(Adam(1e-3), embedding_layers) 就行了.

参考 imdb_lstm_test.py.

交流

QQ交流群:67729435,微信群请加机器人微信号spaces_ac_cn

About

Keras implement of Lazy optimizer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages