Welcome to TensorWatch
TensorWatch is a debugging and visualization tool designed for deep learning and reinforcement learning. It fully leverages Jupyter Notebook to show real time visualizations and offers unique capabilities to query the live training process without having to sprinkle logging statements all over. You can also use TensorWatch to build your own UIs and dashboards. In addition, TensorWatch leverages several excellent libraries for visualizing model graph, review model statistics, explain prediction and so on.
TensorWatch is under heavy development with a goal of providing a research platform for debugging machine learning in one easy to use, extensible and hackable package.
How to Get It
pip install tensorwatch
TensorWatch supports Python 3.x and is tested with PyTorch 0.4-1.x. Most features should also work with TensorFlow eager tensors.
How to Use It
Here's simple code that logs some metric every second:
import tensorwatch as tw import time w = tw.Watcher(filename='test.log') s = w.create_stream(name='my_metric') w.make_notebook() for i in range(1000): s.write((i, i*i)) time.sleep(1)
When you run this code you will notice a Jupyter Notebook file
test.ipynb gets created in your script folder. From command prompt type
jupyter notebook and click on
test.ipynb. Click on Run button to see live line graph as values gets written in your script.
Here's the output in Jupyter Notebook:
In above example, the line graph is used as default visualization. However TensorWatch supports many other visualizations including histogram, pie charts, scatter charts, bar charts and 3D versions of many of these plots. You can simply log your data, specify the chart type you had like to visualize and let TensorWatch take care of the rest. You can also easily create custom visualizations specific to your data.
Comparing Results of Different Runs
TensorWatch architecture is based on streams. By default it saves all streams in a single file representing data from your experiment however you can create individual file for each stream if you prefer. This design allows you to easily compare results of multiple runs in different visualizations with essentially one liners in Jupyter Notebook.
Training within Jupyter Notebook
Many times you might prefer to do data analysis, ML training and testing from within Jupyter Notebook instead of from a separate script. TensorWatch can help you do sophisticated visualizations effortlessly for your code running within Jupyter Notebook.
Querying the Process (Lazy Log Mode)
One of the unique capability TensorWatch offers is to be able to query the live running training process, retrieve the result of this query as stream and direct this stream to your preferred visualization - all of these without explicitly logging any data before hand! We call this new way of debugging lazy logging mode.
For example, below we show input and output image pairs randomly sampled during the training of an autoencoder on fruits dataset. These images were not logged, instead stream of these sampled images were returned on the fly as a response to the user query:
Pre-Training and Post-Training
For example, you can view the model graph with tensor shapes with one liner:
You can view statistics for different layers such as flops, number of parameters etc:
You can view dataset in lower dimensional space using techniques such as t-sne:
We have a goal to provide various tools for explaining predictions over time to help debugging models. Currently we offer several explainers for convolutional networks including Lime. For example, below highlights the areas that causes Resnet50 model to make prediction for class 240:
Join the TensorWatch group on Facebook to stay up to date or ask any questions.
This project is released under the MIT License. Please review the License file for more details.