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

Convert RL Unplugged Atari datasets to tianshou ReplayBuffer #621

Merged
merged 5 commits into from
Apr 29, 2022

Conversation

nuance1979
Copy link
Collaborator

  • I have marked all applicable categories:
    • exception-raising fix
    • algorithm implementation fix
    • documentation modification
    • new feature
  • I have reformatted the code using make format (required)
  • I have checked the code using make commit-checks (required)
  • If applicable, I have mentioned the relevant/related issue(s)
  • If applicable, I have listed every items in this Pull Request below

Add a script to convert RL Unplugged Atari datasets to tianshou ReplayBuffer for better benchmarks. #612

@codecov-commenter
Copy link

codecov-commenter commented Apr 29, 2022

Codecov Report

Merging #621 (227eb39) into master (7f23748) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #621      +/-   ##
==========================================
+ Coverage   93.48%   93.54%   +0.06%     
==========================================
  Files          67       67              
  Lines        4433     4433              
==========================================
+ Hits         4144     4147       +3     
+ Misses        289      286       -3     
Flag Coverage Δ
unittests 93.54% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
tianshou/data/buffer/base.py 99.42% <100.00%> (ø)
tianshou/data/utils/converter.py 100.00% <100.00%> (ø)
tianshou/policy/modelfree/trpo.py 94.91% <0.00%> (+5.08%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@Trinkle23897
Copy link
Collaborator

Also, could you please write something in readme to demonstrate the step-by-step conversion process of rl-unplugged dataset?

@Trinkle23897 Trinkle23897 merged commit 41afc25 into thu-ml:master Apr 29, 2022
@Trinkle23897 Trinkle23897 linked an issue Apr 29, 2022 that may be closed by this pull request
8 tasks
Comment on lines +202 to +204
batch = _tf_example_to_tianshou_batch(example)
buffer.add(batch)
cnt += 1
Copy link
Collaborator

@Trinkle23897 Trinkle23897 Apr 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to use a batch-style process instead of a for-loop, e.g., directly set buffer._meta.obs = ... (or maybe we should create another API to support this thing?)

For example,

buffer = ReplayBuffer(500000)
# add first batch to initialize memory
batch = ...
buffer.add(batch)
# then directly set, I know it's ugly but this is the general idea
meta = buffer._meta
meta.obs = ...
meta.act = ...
...
buffer._meta = meta

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.

Improve discrete control offline RL benchmark
3 participants