I love how simple and clear Keras makes it to build neural networks. With wandb, you can now visualize your networks performance and architecture with a single extra line of python code.
Just add “from wandb import magic” to the top of your training script
To test this functionality, I modified a few scripts in the Keras examples directory.
To install wandb, just run “pip install wandb” and all of my Keras examples should work for you.
1. Simple CNN
I started with the requisite mnist_cnn.py.
I added the “from wandb import magic” line below - you can also look at my mnist_cnn.py forked from the Keras examples with the one line change.
Now when the model runs, wandb starts a process in the background saving relevant metrics and streaming them to wandb.com. You can go to https://app.wandb.ai/l2k2/keras-examples/runs/ovptynun/model and look at the output of my run.
I can see exactly the data that my model is labeling and view the loss and accuracy curves automatically.
2. Resnet on Cifar
Next, I forked cifar10_resnet.py and made the same one line change. You can see a nice visualization of a resnet at https://app.wandb.ai/l2k2/keras-examples/runs/ieqy2e9h/model.
On the system page, I can see that this model is using a little more of my single GPU than the mnist example.
3. Siamese network
Next I tried the siamese network example. Here I might want to look at the TensorFlow graph, luckily with our one line of code we automatically instrument and host TensorBoard. You can find this run at https://app.wandb.ai/l2k2/keras-examples/runs/fsc63n6a?workspace=user-l2k2.
This instrumentation took me under a minute per model, adds very little compute overhead, and should work for any Keras model you are working on. As you want to track more things you may want to replace the one line with:
Then you can use our custom wandb.log() function to save anything you want. You can learn more in our documentation.
I really hope you find this useful!
Enter your email to get updates about new features and blog posts.
We're building lightweight, flexible experiment tracking tools for deep learning. Add a couple of lines to your python script, and we'll keep track of your hyperparameters and output metrics, making it easy to compare runs and see the whole history of your progress. Think of us like GitHub for deep learning.
We are building our library of deep learning articles, and we're delighted to feature the work of community members. Contact Carey to learn about opportunities to share your research and insights.