This library aims to be a complete deep learning framework with extreme flexibility written in Rust. The goal would be to satisfy researchers as well as practitioners making it easier to experiment, train and deploy your models.
Disclamer Burn is currently in active development, and there will be breaking changes. While any resulting issues are likely to be easy to fix, there are no guarantees at this stage.
Sections
Features
- Flexible and intuitive custom neural network module 🔥
- Training with full support for
metric
,logging
andcheckpointing
📈 - Tensor crate with backends as pluging 🔧
- Dataset crate with multiple utilities and sources 📚
Get Started
The best way to get started with burn
is to clone the repo and play with the examples.
This may also be a good idea to take a look the main components of burn
to get a quick overview of the fundamental building blocks.
Examples
- MNIST train a model on CPU/GPU using different backends.
- Text Classification train a transformer encoder from scratch on GPU.
Components
Knowing the main components will be of great help when starting playing with burn
.
Backend
Almost everything is based on the Backend
trait, which allows to run tensor operations with different implementations without having to change your code.
A backend does not necessary have autodiff capabilities, the ADBackend
trait is there to specify when autodiff is required.
Tensor
The Tensor
struct is at the core of the burn
framework.
It takes two generic parameters, the Backend
and the number of dimensions D
,
Backpropagation is also supported on any backend by making them auto differentiable using a simple decorator.
use ;
use ;
use ADBackendDecorator;
use NdArrayBackend;
use TchBackend;
Module
The Module
derive let your create your own neural network modules similar to PyTorch.
use nn;
use ;
use Backend;
Note that only the fields wrapped inside Param
are updated during training, and the other ones should implement Clone
.
Config
The Config
derive lets you define serializable and deserializable configurations or hyper-parameters for your modules or any components.
use Config;
The derive also adds useful methods to your config.
Learner
The Learner
is the main struct
that let you train a neural network with support for logging
, metric
, checkpointing
and more.
In order to create a learner, you must use the LearnerBuilder
.
use LearnerBuilder;
use ;
See this example for a real usage.
License
Burn is distributed under the terms of both the MIT license and the Apache License (Version 2.0). See LICENSE-APACHE and LICENSE-MIT for details. Opening a pull request is assumed to signal agreement with these licensing terms.