Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README usage example doesn't work with Julia 1.11 #73

Closed
zengmao opened this issue Jan 2, 2025 · 4 comments
Closed

README usage example doesn't work with Julia 1.11 #73

zengmao opened this issue Jan 2, 2025 · 4 comments
Assignees

Comments

@zengmao
Copy link

zengmao commented Jan 2, 2025

Using Julia 1.11 in a fresh virtual environment, I ran the following commands:

]add DeepQLearning, POMDPs, Flux, POMDPModels, POMDPTools

using DeepQLearning
using POMDPs
using Flux
using POMDPModels
using POMDPTools

mdp = SimpleGridWorld();

model = Chain(Dense(2, 32), Dense(32, length(actions(mdp))))

exploration = EpsGreedyPolicy(mdp, LinearDecaySchedule(start=1.0, stop=0.01, steps=10000/2))

solver = DeepQLearningSolver(qnetwork = model, max_steps=10000, 
                             exploration_policy = exploration,
                             learning_rate=0.005,log_freq=500,
                             recurrence=false,double_q=true, dueling=true, prioritized_replay=true)

policy = solve(solver, mdp)

I skipped Using POMDPSimulators which is actually not needed in this example (and in fact would cause a precompilation error, at least with Julia 1.11). The above commands ended with the error:

ERROR: UndefVarError: `loadparams!` not defined in `Flux`

Another minor problem was that the printing of exploration resulted in StackOverflowError. This is easily avoided by appending a semicolon to the affected line to suppress the printing.

I'm using Julia Version 1.11.2 on Linux x86_64 (libc).

@zengmao
Copy link
Author

zengmao commented Jan 2, 2025

I think it's because Flux v0.13 removed loadparams!, according to NEWS.md:
https://github.com/FluxML/Flux.jl/blob/cb9bb307b30b9111617e5b28ea1c5398ef3693f3/NEWS.md#v013-april-2022
To fix this, it would be necessary to modify solver.jl:
https://github.com/JuliaPOMDP/DeepQLearning.jl/blob/master/src/solver.jl

@dylan-asmar dylan-asmar self-assigned this Jan 2, 2025
@zengmao
Copy link
Author

zengmao commented Jan 2, 2025

I've submitted a pull request #74 to fix this issue.

@mykelk
Copy link
Member

mykelk commented Jan 2, 2025

Thanks so much!

@dylan-asmar
Copy link
Member

Should be fixed with #76. If there are still any problems, please re-open.

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

No branches or pull requests

3 participants