Skip to content

API reference: Keras integration#

You can use a Neptune callback to capture model training metadata when using TensorFlow with Keras.


For an in-depth tutorial, see IntegrationsWorking with Keras.


Captures model training metadata and logs them to Neptune.

Goes over the last_metrics and smooth_loss after each epoch and logs them to Neptune.


You need to have Keras or TensorFlow 2 installed on your computer to use this module.


Name         Type Default Description
run Run - An existing run reference, as returned by neptune.init_run().
base_namespace str, optional training Namespace under which all metadata logged by the Neptune callback will be stored.
log_model_diagram bool, optional False Save the model visualization. Requires pydot to be installed, otherwise it will silently skip saving the diagram.
log_on_batch bool, optional False Log the metrics also for each batch, not only each epoch.


# Create a run
import as neptune
run = neptune.init_run(project="workspace-name/project-name")  # (1)

# Instantiate the callback
from import NeptuneCallback
neptune_callback = NeptuneCallback(

# Pass the callback to the "callbacks" argument of
    x_train, y_train, callbacks=[neptune_callback]
  1. The full project name. For example, "ml-team/classification". To copy it, navigate to the project settingsProperties.

Log with additional options:

import pydot
import as neptune
from import NeptuneCallback

run = neptune.init_run()

neptune_callback = NeptuneCallback(
    base_namespace="visualizations",  # set a custom namespace name

Back to top