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

feat: add offline algorithms #175

Merged
merged 49 commits into from
May 11, 2023
Merged

Conversation

rockmagma02
Copy link
Contributor

@rockmagma02 rockmagma02 commented Mar 24, 2023

Description

feat: add offline algorithms.

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds core functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)

Implemented Tasks

  • offline data collector
  • offline data datset
  • BCQ
  • BCQ_Lag
  • CRR
  • C_CRR
  • VAE_BC
  • COptiDICE
  • more test cask
  • algo_wrapper refactor
  • benchmark

Checklist

Go over all the following points, and put an x in all the boxes that apply.
If you are unsure about any of these, don't hesitate to ask. We are here to help!

  • I have read the CONTRIBUTION guide. (required)
  • My change requires a change to the documentation.
  • I have updated the tests accordingly. (required for a bug fix or a new feature)
  • I have updated the documentation accordingly.
  • I have reformatted the code using make format. (required)
  • I have checked the code using make lint. (required)
  • I have ensured make test pass. (required)

@codecov
Copy link

codecov bot commented Mar 24, 2023

Codecov Report

Patch coverage: 25.89% and project coverage change: -11.03 ⚠️

Comparison is base (3df1725) 86.01% compared to head (45b54db) 74.99%.

❗ Current head 45b54db differs from pull request most recent head a354e5d. Consider uploading reports for the commit a354e5d to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##              dev     #175       +/-   ##
===========================================
- Coverage   86.01%   74.99%   -11.03%     
===========================================
  Files          82       98       +16     
  Lines        4226     5166      +940     
===========================================
+ Hits         3635     3874      +239     
- Misses        591     1292      +701     
Impacted Files Coverage Δ
omnisafe/common/offline/data_collector.py 0.00% <0.00%> (ø)
omnisafe/common/offline/dataset.py 15.47% <15.47%> (ø)
omnisafe/algorithms/offline/coptidice.py 18.42% <18.42%> (ø)
omnisafe/algorithms/offline/c_crr.py 22.66% <22.66%> (ø)
omnisafe/algorithms/offline/bcq.py 25.37% <25.37%> (ø)
omnisafe/algorithms/offline/crr.py 25.75% <25.75%> (ø)
omnisafe/algorithms/offline/bcq_lag.py 26.15% <26.15%> (ø)
omnisafe/models/offline/dice.py 30.23% <30.23%> (ø)
omnisafe/algorithms/offline/base.py 35.08% <35.08%> (ø)
omnisafe/adapter/offline_adapter.py 40.00% <40.00%> (ø)
... and 13 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rockmagma02 rockmagma02 added feature Something related to new features algorithm Some issues about algorithm labels Mar 25, 2023
@rockmagma02 rockmagma02 force-pushed the dev-offline branch 2 times, most recently from 1e57624 to 094ceb9 Compare April 2, 2023 12:02
@codecov-commenter
Copy link

codecov-commenter commented Apr 16, 2023

Codecov Report

Merging #175 (bd7595b) into dev (e0b1852) will decrease coverage by 0.70%.
The diff coverage is 91.26%.

❗ Current head bd7595b differs from pull request most recent head 056e5c5. Consider uploading reports for the commit 056e5c5 to get more accurate results

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##              dev     #175      +/-   ##
==========================================
- Coverage   95.99%   95.29%   -0.70%     
==========================================
  Files         118      134      +16     
  Lines        5992     6904     +912     
==========================================
+ Hits         5752     6579     +827     
- Misses        240      325      +85     
Impacted Files Coverage Δ
omnisafe/adapter/online_adapter.py 100.00% <ø> (ø)
omnisafe/algorithms/base_algo.py 100.00% <ø> (ø)
omnisafe/common/experiment_grid.py 96.43% <ø> (ø)
omnisafe/envs/safety_gymnasium_env.py 97.96% <ø> (ø)
omnisafe/utils/exp_grid_tools.py 50.00% <ø> (ø)
omnisafe/common/offline/dataset.py 64.53% <64.53%> (ø)
omnisafe/models/actor/actor_builder.py 96.15% <83.33%> (-3.85%) ⬇️
omnisafe/algorithms/offline/coptidice.py 92.17% <92.17%> (ø)
omnisafe/common/offline/data_collector.py 94.34% <94.34%> (ø)
omnisafe/models/offline/dice.py 95.65% <95.65%> (ø)
... and 25 more

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rockmagma02 rockmagma02 marked this pull request as ready for review April 17, 2023 14:26
examples/train_policy.py Outdated Show resolved Hide resolved
examples/collect_offline_data.py Outdated Show resolved Hide resolved
examples/train_policy.py Outdated Show resolved Hide resolved
omnisafe/adapter/offline_adapter.py Outdated Show resolved Hide resolved
omnisafe/adapter/offline_adapter.py Outdated Show resolved Hide resolved
omnisafe/adapter/offline_adapter.py Show resolved Hide resolved
omnisafe/algorithms/offline/bcq.py Show resolved Hide resolved
omnisafe/algorithms/offline/bcq.py Outdated Show resolved Hide resolved
omnisafe/algorithms/offline/coptidice.py Show resolved Hide resolved
omnisafe/algorithms/offline/coptidice.py Outdated Show resolved Hide resolved
omnisafe/common/offline/__init__.py Show resolved Hide resolved
Copy link
Member

@Gaiejj Gaiejj left a comment

Choose a reason for hiding this comment

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

Some common mistakes have been mentioned in PR #221 's comment: #221 (review).
Please follow it then make sure the code can pass make mypy

@Gaiejj Gaiejj self-requested a review April 23, 2023 02:19
@zmsn-2077
Copy link
Member

Please upload the benchmark exp results with these algorithms.

benchmarks/offline/README.md Outdated Show resolved Hide resolved
omnisafe/adapter/offline_adapter.py Outdated Show resolved Hide resolved
Copy link
Member

@Gaiejj Gaiejj left a comment

Choose a reason for hiding this comment

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

Some files are polish needed, but this Pull Request can be merged first and I will fix them in future Pull Request.

@zmsn-2077 zmsn-2077 merged commit 2a37bab into PKU-Alignment:dev May 11, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
algorithm Some issues about algorithm feature Something related to new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants