burn_telemetry 🔥📊
Training logger plugins for Burn
Export training metrics to various observability and visualization platforms with minimal overhead.
features
OpenTelemetry Logger (otel feature)
Export metrics to OpenTelemetry-compatible backends (Prometheus, Jaeger, etc.)
- 🚀 Minimal overhead - Efficient async export with configurable batching
- 🎯 Multi-GPU/node support - Resource attributes for distributed training
- 🔌 OTLP & stdout - Support for OTLP protocol and debugging via stdout
- ⚙️ Configurable - Fine-tune export intervals, batch sizes, and timeouts
Rerun Logger (rerun feature)
Rich visualization with Rerun.io for training metrics, images, and tensors
- Rich visualizations - Images, videos, tensors, and custom data types
- Timeline-based - Explore metric evolution across training epochs
- Interactive - Real-time visualization during training
- Multi-modal - Scalars, text, images, tensors all in one view
- Video streaming - Incremental frame logging for live training visualization
usage
OpenTelemetry
use LearnerBuilder;
use ;
// Configure OpenTelemetry logger
let config = new
.with_endpoint // OTLP endpoint
.with_resource_attribute // Multi-GPU tracking
.with_resource_attribute;
// Create logger
let otel_logger = new.expect;
// Use with LearnerBuilder
let learner = new
.metric_train_numeric
.metric_valid_numeric
.metric_logger
.build;
Rerun
use LearnerBuilder;
use ;
use ;
// Configure Rerun logger
let config = new
.with_spawn_viewer; // Opens Rerun viewer automatically
// Create logger
let mut rerun_logger = new.expect;
// Use with LearnerBuilder for standard metrics
let learner = new
.metric_train_numeric
.metric_logger
.build;
// Log custom visualizations (images, tensors, videos, etc.)
let image_tensor: = /* ... */;
let rerun_image = image_tensor.into_rerun_image.await;
rerun_logger.log_image;
// Log videos (4D tensor with shape [T, H, W, C])
let video_tensor: = /* ... */;
let video_frames = video_tensor.into_rerun_video.await;
rerun_logger.log_video;
// Video streaming - log frames incrementally with automatic cleanup
let stream_handle = rerun_logger.init_video_stream;
for frame_tensor in training_frames
// Stream is automatically cleaned up when handle is dropped
Using Multiple Loggers
Combine multiple loggers to export to multiple backends simultaneously:
use MultiLogger;
use OpenTelemetryLogger;
use RerunLogger;
// Create individual loggers
let otel_logger = new?;
let rerun_logger = new?;
// Combine them with MultiLogger
let multi_logger = new
.add_logger
.add_logger;
// Use with LearnerBuilder
let learner = new
.metric_train_numeric
.metric_logger
.build;
For a runnable end-to-end walkthrough see example/multi_logger.rs, which
initializes both backends and streams a short training loop through the combined logger.
cargo features
[]
= { = "0.1", = ["otel", "rerun"] }
Available features:
otel(default) - OpenTelemetry loggerrerun- Rerun.io logger- Both can be enabled simultaneously
examples
The showcase MNIST example lives at example/mnist.rs and automatically wires in whichever
telemetry features you compiled:
-
cargo run --example mnist --features rerun,otelStreams scalar metrics to Rerun and OpenTelemetry simultaneously while also logging sample images plus predictions after training. Use--record-to,--limit-train,--limit-valid,--full-dataset,--preview-samples, and--quickto match your demo needs. -
cargo run --example multi_logger --features otel,rerunDrives both loggers simultaneously, exercisingmax_batch_size/async_exportwith OTLP while streaming the same metrics into a live Rerun viewer.
The MNIST dataset is downloaded the first time you run an example and cached in
~/.cache/burn-dataset/mnist. For quick sanity checks you can limit the dataset size:
Examples default to the CUDA backend (device 0) and limit training to 10k train / 2k valid
samples so they converge quickly during demos. Use --full-dataset to remove those limits or
--limit-* to pin precise counts. See cargo run --example mnist -- --help
for the full list of CLI flags shared by the harness. Running the CUDA backend requires a machine
with a compatible NVIDIA driver and CUDA runtime; fall back to the CPU build if you do not have one.
attribution
The Burn-to-Rerun conversion utilities are adapted from brush by Arthur Brussee.