handle epoch elsewhere
This commit is contained in:
parent
aeaa138b6d
commit
085d3aa9b4
|
@ -4,14 +4,11 @@ using Flux.Tracker: back!
|
|||
tocb(f) = f
|
||||
tocb(fs::AbstractVector) = () -> foreach(call, fs)
|
||||
|
||||
function train!(m, data, opt; epoch = 1, cb = () -> ())
|
||||
function train!(m, data, opt; cb = () -> ())
|
||||
cb = tocb(cb)
|
||||
@progress for e in 1:epoch
|
||||
epoch > 1 && info("Epoch $e")
|
||||
@progress for (x, y) in data
|
||||
back!(m(x, y))
|
||||
opt()
|
||||
cb()
|
||||
end
|
||||
@progress for (x, y) in data
|
||||
back!(m(x, y))
|
||||
opt()
|
||||
cb()
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue