FluxML / FluxTraining.jl

A flexible neural net training library inspired by fast.ai
https://fluxml.ai/FluxTraining.jl
MIT License
117 stars 25 forks source link

How not to have printing callbacks? #126

Closed KronosTheLate closed 2 years ago

KronosTheLate commented 2 years ago

Is there a way of constructing a Learner without certain callbacks?

julia> Learner(predict, lossfn; callbacks = [Metrics(accuracy)]).callbacks
FluxTraining.Callbacks(FluxTraining.SafeCallback[Metrics(Loss(), Metric(Accuracy)), ProgressPrinter(), MetricsPrinter(), StopOnNaNLoss(), Recorder()], FluxTraining.LinearRunner(), {5, 5} directed simple Int64 graph, false)

julia> Learner(predict, lossfn).callbacks
FluxTraining.Callbacks(FluxTraining.SafeCallback[ProgressPrinter(), MetricsPrinter(), StopOnNaNLoss(), Recorder(), Metrics(Loss())], FluxTraining.LinearRunner(), {5, 5} directed simple Int64 graph, false)

Or at least, to remove callbacks after construction? image

lorenzoh commented 2 years ago

You can either create the learner with Learner(...; usedefaultcallbacks=false) to turn off all the included callbacks, or remove them with FluxTraining.removecallback!(learner, CallbackType) (see removecallback!).

In your case, using FluxTraining.removecallback!(learner, ProgressPrinter) should do the trick.

KronosTheLate commented 2 years ago

Thanks. Looking into where this would go into the docs now.