Skip to main content

AdaBound optimizer in Keras

Project description

Keras AdaBound

Travis Coverage

AdaBound optimizer in Keras.


pip install keras-adabound


Use the optimizer

from keras_adabound import AdaBound

model.compile(optimizer=AdaBound(lr=1e-3, final_lr=0.1), loss=model_loss)

Load with custom objects

from keras_adabound import AdaBound

model = keras.models.load_model(model_path, custom_objects={'AdaBound': AdaBound})

About weight decay

The optimizer does not have an argument named weight_decay (as in the official repo) since it can be done by adding L2 regularizers to weights:

import keras

regularizer = keras.regularizers.l2(WEIGHT_DECAY / 2)
for layer in model.layers:
    for attr in ['kernel_regularizer', 'bias_regularizer']:
        if hasattr(layer, attr) and layer.trainable:
            setattr(layer, attr, regularizer)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keras-adabound-0.6.0.tar.gz (5.5 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page