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

R2D2 #34

Merged
merged 77 commits into from
Mar 3, 2025
Merged

R2D2 #34

merged 77 commits into from
Mar 3, 2025

Conversation

garymm
Copy link
Owner

@garymm garymm commented Mar 3, 2025

R2D2 agent and the necessary changes to Earl to implement it.

  • Change GymnasiumLoop to take an env factory. The assumption that we could copy.deepcopy() was not a good one.
  • Support envpool in GymnasiumLoop.
  • Support updating experience state in Agent.loss().
  • Bug fixes in GymnasiumLoop.

I think the key is doing a reversed loop for the n step returns rather
than a vmap
to support setting priorities for replay
currently crashes with regular python, probably due to buffer donation
bug, but runs with debug python

not sure if it's working yet
does not appear to be learning cartpole, so something is wrong
add more tests
test_r2d2_learns_cartpole currently fails
before it seems it was a no-op for some reason having to do with vmap
this matches the implementation in Acme
add learning rate schedule

make number of optimizations per cycle configurable

log hyperparameters
Main thing changed was shrinking replay buffer
@garymm garymm enabled auto-merge (squash) March 3, 2025 06:14
@garymm garymm merged commit 9fb5720 into master Mar 3, 2025
4 checks passed
@garymm garymm deleted the r2d2 branch March 3, 2025 06:32
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 86.20690% with 88 lines in your changes missing coverage. Please review.

Project coverage is 93.08%. Comparing base (15dbe65) to head (a18c16f).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
earl/agents/r2d2/utils.py 63.11% 45 Missing ⚠️
earl/agents/r2d2/r2d2.py 87.97% 35 Missing ⚠️
earl/agents/r2d2/networks.py 96.15% 6 Missing ⚠️
earl/environment_loop/gymnasium_loop.py 94.59% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #34      +/-   ##
==========================================
- Coverage   96.74%   93.08%   -3.67%     
==========================================
  Files          13       16       +3     
  Lines        1168     1750     +582     
==========================================
+ Hits         1130     1629     +499     
- Misses         38      121      +83     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

2 participants