RAdam implemented in Keras & TensorFlow
Project description
Keras RAdam
Unofficial implementation of RAdam in Keras and TensorFlow.
Install
pip install keras-rectified-adam
External Link
Usage
import keras
import numpy as np
from keras_radam import RAdam
# Build toy model with RAdam optimizer
model = keras.models.Sequential()
model.add(keras.layers.Dense(input_shape=(17,), units=3))
model.compile(RAdam(), loss='mse')
# Generate toy data
x = np.random.standard_normal((4096 * 30, 17))
w = np.random.standard_normal((17, 3))
y = np.dot(x, w)
# Fit
model.fit(x, y, epochs=5)
TensorFlow without Keras
from keras_radam.training import RAdamOptimizer
RAdamOptimizer(learning_rate=1e-3)
Use Warmup
from keras_radam import RAdam
RAdam(total_steps=10000, warmup_proportion=0.1, min_lr=1e-5)
Q & A
About Correctness
The optimizer produces similar losses and weights to the official optimizer after 500 steps.
Use tf.keras
or tf-2.0
Add TF_KERAS=1
to environment variables to use tensorflow.python.keras
.
Use theano
Backend
Add KERAS_BACKEND=theano
to environment variables to enable theano
backend.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for keras-rectified-adam-0.17.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8adab980575bfdf50ec2683dabf2293092bd28fbb8b7c0365561101a91a3bca7 |
|
MD5 | cb6e0253e596c46b9a64a5f8ffa22905 |
|
BLAKE2b-256 | 21799521f66b92186702cb58a214c1b923b416266381cd824e15a1733f6a5b06 |