diff --git a/ext/OptimisersAdaptExt.jl b/ext/OptimisersAdaptExt.jl index 6b15700..172b0eb 100644 --- a/ext/OptimisersAdaptExt.jl +++ b/ext/OptimisersAdaptExt.jl @@ -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