EnzymeAD / Reactant.jl

MIT License
26 stars 2 forks source link

Patches for Lux integration #7

Closed avik-pal closed 1 month ago

avik-pal commented 1 month ago

I am pulling out the patches from https://github.com/EnzymeAD/Reactant.jl/pull/5, so that we can get them in faster

avik-pal commented 1 month ago

Could array interface be done in an extension package if it's not in base

Done

wsmoses commented 1 month ago

Ah looking at that error I think we should trace the primal and shadow arrays into tracedrarrays so then the duplicates invariant holds. We'll need the data as an rarray anyways to run it

On Mon, May 27, 2024, 11:33 PM Avik Pal @.***> wrote:

@.**** commented on this pull request.

In src/utils.jl https://github.com/EnzymeAD/Reactant.jl/pull/7#discussion_r1616400841:

@@ -7,7 +7,7 @@ function transpose_val(val) return MLIR.IR.result(MLIR.Dialects.stablehlo.transpose(val, permutation=attr), 1) end

-function apply(f, args...; kwargs) +function apply(f, args...; kwargs...)

This came up in computing the gradient of the model with Enzyme. But that code is not completely functional yet, see LuxDL/Lux.jl#665 (comment) https://github.com/LuxDL/Lux.jl/pull/665#issuecomment-2133946153

— Reply to this email directly, view it on GitHub https://github.com/EnzymeAD/Reactant.jl/pull/7#discussion_r1616400841, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJTUXFWCLE53NPEVDMVQGLZEORCZAVCNFSM6AAAAABIKKBQG6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDAOBRGQ4DANZQGY . You are receiving this because you commented.Message ID: @.***>

wsmoses commented 1 month ago

However separate from this fix (which ought be done regardless) it is surprising that the original model is not an rarray as I would expect. That should probably be fixed in lux

On Mon, May 27, 2024, 11:36 PM Billy Moses @.***> wrote:

Ah looking at that error I think we should trace the primal and shadow arrays into tracedrarrays so then the duplicates invariant holds. We'll need the data as an rarray anyways to run it

On Mon, May 27, 2024, 11:33 PM Avik Pal @.***> wrote:

@.**** commented on this pull request.

In src/utils.jl https://github.com/EnzymeAD/Reactant.jl/pull/7#discussion_r1616400841:

@@ -7,7 +7,7 @@ function transpose_val(val) return MLIR.IR.result(MLIR.Dialects.stablehlo.transpose(val, permutation=attr), 1) end

-function apply(f, args...; kwargs) +function apply(f, args...; kwargs...)

This came up in computing the gradient of the model with Enzyme. But that code is not completely functional yet, see LuxDL/Lux.jl#665 (comment) https://github.com/LuxDL/Lux.jl/pull/665#issuecomment-2133946153

— Reply to this email directly, view it on GitHub https://github.com/EnzymeAD/Reactant.jl/pull/7#discussion_r1616400841, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJTUXFWCLE53NPEVDMVQGLZEORCZAVCNFSM6AAAAABIKKBQG6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDAOBRGQ4DANZQGY . You are receiving this because you commented.Message ID: @.***>