Write events for TensorBoard
Insights
mlverse/tfevents
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
main
View all tags
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Cancel
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more .
You don't have access just yet, but in the meantime, you can learn about Codespaces
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Failed to load latest commit information.
Type
README.md
tfevents
tfevents allows logging data from machine learning experiments to a file format that can be later consumed by TensorBoard in order to generate visualizations.
Installation
You can install the development version of tfevents from GitHub with:
Note: Currently only MacOS and Linux are supported. Windows support coming soon!
You need to have cmake on your path. See installation instructions in the cmake install webpage - or:
If you use brew on MacOS you can run:
brew install cmake
Or on linux install the cmake library, for example on Debian systems:
sudo apt install cmake
# install.packages("devtools") devtools::install_github("mlverse/tfevents")
Example
The main entrypoint in tfevents API is the log_event function. It can be used to log summaries like scalars, images, audio (Coming soon), histograms (Coming soon) and arbitrary tensors (soon) to a log directory, which we like to call logdir. You can later point TensorBoard to this logdir to visualize the results.
library(tfevents)
Summaries are always associated to a step in the TensorBoard API, and log_event automatically increases the step everytime it’s called, unless you provide the step argument.
Let’s start by logging some metrics:
epochs ├── train #> │ └── events.out.tfevents.1668024224.v2 #> └── valid #> └── events.out.tfevents.1668024224.v2">
fs::dir_tree("logs") #> logs #> ├── train #> │ └── events.out.tfevents.1668024224.v2 #> └── valid #> └── events.out.tfevents.1668024224.v2
You can later point TensorBoard to that logdir using TensorBoard’s command line interface or tensorflow’s utility function tensorboard()
Loaded Tensorflow version 2.10.0 #> Started TensorBoard at http://127.0.0.1:6060">
tensorflow::tensorboard(normalizePath("logs"), port = 6060) #> Loaded Tensorflow version 2.10.0 #> Started TensorBoard at http://127.0.0.1:6060
TensorBoard will display the results in a dashbboard, similar to one you can see in the screenshot below:
You can learn more in the tfevents website .
About