FluxML / FluxTraining.jl

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

Simpler `Learner` API #104

Closed lorenzoh closed 2 years ago

lorenzoh commented 2 years ago

Currently, Learner takes 4 positional arguments plus any number of callbacks as positional arguments. Not the cleanest API, so an additional method, more concise method should be added to construct Learners.

This new method could dispatch to the current method, but should be favored in the documentation. Implementation looks something like:

function Learner(model, lossfn; optim=ADAM(), data=nothing, callbacks=[], kwargs...)
    return Learner(model, data, optim, lossfn, callbacks...; kwargs...)
end

This also brings consistency with FastAI.tasklearner, which already takes callbacks as a keyword argument.