TensorBoardLogger.jl is a native library for logging arbitrary data to Tensorboard, extending Julia's standard Logging framework.
Many ideas are taken from UniversalTensorBoard and from TensorBoardX. It is based on ProtoBuf.jl.
To install run the following command in the julia REPL:
] add TensorBoardLogger
To also enable support for Images, also install ImageMagick
] add ImageMagick
The fundamental type defined in this package is a TBLogger
, which behaves like
other standard loggers in Julia such as ConsoleLogger
or TextLogger
. You can
create one by passing it the path to the folder where you want to store the data.
You can also pass an optional second argument to specify the behaviour in case
there already exhist a document at the given path.
Once you have created a TBLogger
, you can use it as you would use any other
logger in Julia:
- You can set it to be your global logger with the function global_logger
- You can set it to be the current logger in a scope with the function with_logger
- You can combine it with other Loggers using LoggingExtras.jl, so that messages are logged to TensorBoard and to other backends at the same time.
using TensorBoardLogger, Logging, Random
lg=TBLogger("tensorboard_logs/run", min_level=Logging.Info)
struct sample_struct first_field; other_field; end
with_logger(lg) do
for i=1:100
x0 = 0.5+i/30; s0 = 0.5/(i/20);
edges = collect(-5:0.1:5)
centers = collect(edges[1:end-1] .+0.05)
histvals = [exp(-((c-x0)/s0)^2) for c=centers]
data_tuple = (edges, histvals)
data_struct = sample_struct(i^2, i^1.5-0.3*i)
@info "test" i=i j=i^2 dd=rand(10).+0.1*i hh=data_tuple
@info "test_2" i=i j=2^i hh=data_tuple log_step_increment=0
@info "" my_weird_struct=data_struct log_step_increment=0
@debug "debug_msg" this_wont_show_up=i
end
end
Support for Computational Graphs is currently planned and partly implemented.
Contributions are welcome! You can get in touch by opening an issue, sending me an email or on slack (@PhilipVinc).