Keras

Use our callback to automatically save all the metrics and the loss values tracked in model.fit.

import wandb
from wandb.keras import WandbCallback
wandb.init(config={"hyper": "parameter"})
... # code to set up your model in Keras
# 🧙 magic
model.fit(X_train, y_train, validation_data=(X_test, y_test),
callbacks=[WandbCallback()])

Usage Examples

Try our integration out in a colab notebook (with video walkthrough below) or see our example repo for scripts, including a Fashion MNIST example and the W&B Dashboard it generates.

Configuring the WandbCallback

The WandbCallback class supports a wide variety of logging configuration options: specifying a metric to monitor, tracking of weights and gradients, logging of predictions on training_data and validation_data, and more.

Check out the reference documentation for the keras.WandbCallback for details.

Frequently Asked Questions

How do I use Keras multiprocessing with wandb?

If you're setting use_multiprocessing=True and seeing an error like:

Error('You must call wandb.init() before wandb.config.batch_size')

then try this:

  1. In the Sequence class construction, add: wandb.init(group='...')

  2. In your main program, make sure you're using if __name__ == "__main__": and then put the rest of your script logic inside that.