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.


To use this module, you need to have Keras or TensorFlow 2 installed on your machine.


Name         Type Default Description
run Run - (required) 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(run=run)

# Pass the callback to the "callbacks" argument of, 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 as neptune
from import NeptuneCallback

run = neptune.init_run()

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