Skip to content

Complete Lux+Reactant migration: inference, callbacks, and multi-loss support#25

Open
AdityaPandeyCN wants to merge 13 commits intoEvovest:lux-newfrom
AdityaPandeyCN:aditya/lux
Open

Complete Lux+Reactant migration: inference, callbacks, and multi-loss support#25
AdityaPandeyCN wants to merge 13 commits intoEvovest:lux-newfrom
AdityaPandeyCN:aditya/lux

Conversation

@AdityaPandeyCN
Copy link

This PR adds _forward using Lux.apply with separated params/state for inference, _sync_params_to_model! to copy TrainState to CPU for callbacks, _get_lux_loss to dispatch the correct loss per task, one-hot encoding for classification targets, and fit_iter! for MLJ support.

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
@AdityaPandeyCN AdityaPandeyCN marked this pull request as ready for review February 16, 2026 08:22
@AdityaPandeyCN
Copy link
Author

Please take a look when free @jeremiedb.

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
src/Fit/fit.jl Outdated
Comment on lines 73 to 83
Copy link
Member

Choose a reason for hiding this comment

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

What is the need for all_batches?
Why not just keep dtrain_loader? Collecting the iterator doesn't seem a sound practice, it would notably cause problems if the dataloader was a lazy iterator accessing larger than memory data.
Also, I wasn't aware of of any issue when using Flux, nor in the initial Lux adaption under neuro-v3.

As per the one-hot, I don't think this should be needed either, as I'd expect the crossentropy loss to work fine with an integer encoding of the multi-class target. Or is it something specific that Lux doesn't support while Flux does?

BatchNorm(nfeats),
Parallel(
vcat,
StackTree(nfeats => outsize;
Copy link
Member

Choose a reason for hiding this comment

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

The idea for stack tree was to facilitate the stacking of stack_size NeuroTrees in a residual network fashion.
That being said, maybe that model contruction in Lux makes it easy to do the equivalent by composing NeuroTrees in the same way as a vanilla residual architecture would do with Dense layers?

Copy link
Member

@jeremiedb jeremiedb left a comment

Choose a reason for hiding this comment

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

Thanks! The initial benchmark look good.
I appreciate the cleanup regarding code dupliocation in inference, it was long due!

I left a couple of comments, which I think should be striaghforward to adress.
There's the collect of batches which appeared at first sight as not being a change needed, or that may be need a redesign within the DataLoader logic.

… with native for cleaner residual stacking.

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments