Documentation
Search…
Keras
Use our callback to automatically save all the metrics and the loss values tracked in model.fit.
1
import wandb
2
from wandb.keras import WandbCallback
3
4
wandb.init(config={"hyper": "parameter"})
5
6
... # code to set up your model in Keras
7
8
# 🧙 magic
9
model.fit(X_train, y_train, validation_data=(X_test, y_test),
10
callbacks=[WandbCallback()])
Copied!

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.

Frequently Asked Questions

How do I use Keras multiprocessing with wandb?

If you're setting use_multiprocessing=True and seeing an error like:
1
Error('You must call wandb.init() before wandb.config.batch_size')
Copied!
then try this:
  1. 1.
    In the Sequence class construction, add: wandb.init(group='...')
  2. 2.
    In your main program, make sure you're using if __name__ == "__main__": and then put the rest of your script logic inside that.
Last modified 2mo ago