# ParameterSchedulers causing error with Flux.update!

**URL:** <https://discourse.julialang.org/t/parameterschedulers-causing-error-with-flux-update/114287>\
**Category:** Machine Learning\
**Created:** [May 15, 2024, 7:56am UTC](https://discourse.julialang.org/t/parameterschedulers-causing-error-with-flux-update/114287 "2024-05-15T07:56:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cjs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjs/32/208624_2.png) [@cjs](https://discourse.julialang.org/u/cjs)\
**Post date:** [May 15, 2024, 7:56am UTC](https://discourse.julialang.org/t/parameterschedulers-causing-error-with-flux-update/114287/1 "2024-05-15T07:56:32Z")

</div>

I am running a DRL algorithm with Adam where I want the learning rate to decay with time. As an example, consider

```julia
using Flux, ParameterSchedulers
model = Chain(Dense(5,10,gelu), Dense(10,10,gelu), Dense(10,1,softplus))

ps = Flux.params(model)
# gs is calculated gradient

```

At the updating step, I want the learning rate to decay, say

```julia
sched = Sequence(Exp(λ = 1f-7, γ=1000^(1/100)) => 100, Exp(λ = 1f-4, γ=0.99) => 100)
optimiser = Scheduler(sched, ADAM())
Flux.update!(optimiser, ps, gs)

```

Unfortunately, this gives the error

```julia
ERROR: Optimisers.jl cannot be used with Zygote.jl's implicit gradients, `Params` & `Grads`

```

I can get Flux.update! to work only if I use

```julia
optimiser = Flux.Optimise.ADAM()

```

but in this case I am unable to use ParameterSchedulers to vary the learning rate.
