Skip to content

Commit

Permalink
callback_pre
Browse files Browse the repository at this point in the history
  • Loading branch information
guo-yong-zhi committed Jan 12, 2022
1 parent 08a14e3 commit c11ab4b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/fit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ end
function train!(ts, nepoch::Number=-1, args...;
trainer=trainepoch_EM2!, patient::Number=trainer(:patient),
optimiser=Momentum=1/4), scheduler=lr->lr*√0.5,
callback=x -> x, reposition=i -> true, resource=trainer(inputs=ts), kargs...)
callback=x -> x, callback_pre=x -> x, reposition=i -> true, resource=trainer(inputs=ts), kargs...)
reposition_flag = true
if reposition isa Function
from = reposition
Expand Down Expand Up @@ -482,6 +482,7 @@ function train!(ts, nepoch::Number=-1, args...;
@info "nepoch: $nepoch, " * (reposition_flag ? "patient: $patient" : "reposition off")
updated = get(resource, :updated, nothing)
while ep < nepoch
callback_pre(ep)
nc = trainer(ts, args...; resource..., optimiser=optimiser, unique=false, kargs...)
ep += 1
update!(indi_r, nc)
Expand Down

2 comments on commit c11ab4b

@guo-yong-zhi
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/52199

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.8.3 -m "<description of version>" c11ab4bf81e80f2c53b64601b08fd85b9e4880e6
git push origin v0.8.3

Please sign in to comment.