Skip to content

Commit

Permalink
Update ext/OptimisersAdaptExt.jl
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Abbott <32575566+mcabbott@users.noreply.github.com>
  • Loading branch information
vpuri3 and mcabbott authored Nov 12, 2024
1 parent 8c1c073 commit 978ed6f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ext/OptimisersAdaptExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import Optimisers: Leaf

function Adapt.adapt_structure(to, leaf::Leaf)
@warn """`Optimisers.Leaf` object does not support device transfer via
`Adapt.jl`. This could lead to incorrect gradient updates. Avoid this by
calling `Flux.gpu/cpu` or `MLDataDevices.cpu_device()/gpu_device()` on the
`Adapt.jl`. This is because `Adapt.jl` does not handle shared parameters (i.e. the same parameter array
appearing more than once in the model), and in such cases this will lead to incorrect gradient updates.
Avoid this by calling `Flux.gpu/cpu` or `MLDataDevices.cpu_device()/gpu_device()` on the
optimiser state object.
""" maxlog=1

Expand Down

0 comments on commit 978ed6f

Please sign in to comment.