README

Start here

Library

Reference

Tutorials

Other

Using callbacks

Callbacks allow injecting functionality at many points during the training loop.

To use them, pass a list of callbacks to Learner:

learner = Learner(
    model, data, optimizer, lossfn,  # required arguments
    ToGPU(), Metrics(accuracy))      # pass any number of callbacks as additional arguments
Learner()

Some useful callbacks are added by default:

learner.callbacks.cbs
7-element Array{FluxTraining.SafeCallback,1}:
 ToGPU()
 Metrics(Loss(), Metric(Accuracy))
 ProgressPrinter()
 MetricsPrinter()
 StopOnNaNLoss()
 Recorder()
 SanityCheck(FluxTraining.Check[Check("Has training data iterator"), Check("Has validation data iterator"), Check("Data iterators iterate over tuples"), Check("Model and loss function compatible with data")], false)

See callback reference for a list of all callbacks included in FluxTraining.jl and their documentation.

Ordering

The order the callbacks are passed in doesn’t matter. FluxTraining.jl creates a dependency graph that makes sure the callbacks are run in the correct order. Read custom callbacks to find out how to create callbacks yourself.