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

feature(zjow): add qgpo policy for new DI-engine pipeline #757

Merged
merged 39 commits into from
Feb 4, 2024

Conversation

zjowowen
Copy link
Collaborator

@zjowowen zjowowen commented Dec 7, 2023

Add qgpo policy for new DI-engine pipeline based on the implementation of repo https://github.com/ChenDRAG/CEP-energy-guided-diffusion.

@zjowowen zjowowen added the algo Add new algorithm or improve old one label Dec 7, 2023
ding/example/qgpo.py Outdated Show resolved Hide resolved
ding/model/common/encoder.py Show resolved Hide resolved
ding/policy/qgpo.py Outdated Show resolved Hide resolved
ding/policy/qgpo.py Outdated Show resolved Hide resolved
ding/policy/qgpo.py Outdated Show resolved Hide resolved
ding/torch_utils/network/activation.py Outdated Show resolved Hide resolved
dizoo/d4rl/config/halfcheetah_medium_expert_qgpo_config.py Outdated Show resolved Hide resolved
@PaParaZz1 PaParaZz1 changed the title feature(zjow): Add qgpo policy for new DI-engine pipeline feature(zjow): add qgpo policy for new DI-engine pipeline Dec 27, 2023
Copy link

codecov bot commented Dec 27, 2023

Codecov Report

Attention: 739 lines in your changes are missing coverage. Please review.

Comparison is base (acd23e5) 76.82% compared to head (8002cd6) 75.80%.
Report is 3 commits behind head on main.

❗ Current head 8002cd6 differs from pull request most recent head e28b1c5. Consider uploading reports for the commit e28b1c5 to get more accurate results

Files Patch % Lines
...ng/torch_utils/diffusion_SDE/dpm_solver_pytorch.py 6.35% 427 Missing ⚠️
ding/model/template/qgpo.py 20.49% 128 Missing ⚠️
ding/policy/qgpo.py 24.09% 63 Missing ⚠️
ding/framework/middleware/functional/evaluator.py 1.61% 61 Missing ⚠️
.../framework/middleware/functional/data_processor.py 10.71% 50 Missing ⚠️
ding/torch_utils/network/res_block.py 27.27% 8 Missing ⚠️
ding/framework/middleware/functional/logger.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #757      +/-   ##
==========================================
- Coverage   76.82%   75.80%   -1.03%     
==========================================
  Files         676      679       +3     
  Lines       54328    55272     +944     
==========================================
+ Hits        41737    41897     +160     
- Misses      12591    13375     +784     
Flag Coverage Δ
unittests 75.80% <12.95%> (-1.03%) ⬇️

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

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

ding/example/qgpo.py Outdated Show resolved Hide resolved
ding/policy/qgpo.py Outdated Show resolved Hide resolved
dizoo/d4rl/config/halfcheetah_medium_expert_qgpo_config.py Outdated Show resolved Hide resolved
ding/torch_utils/network/res_block.py Show resolved Hide resolved
ding/torch_utils/network/res_block.py Outdated Show resolved Hide resolved
ding/policy/qgpo.py Outdated Show resolved Hide resolved
ding/model/common/encoder.py Outdated Show resolved Hide resolved
ding/model/template/qgpo.py Outdated Show resolved Hide resolved
ding/model/template/qgpo.py Outdated Show resolved Hide resolved
ding/model/template/qgpo.py Outdated Show resolved Hide resolved
ding/example/qgpo.py Outdated Show resolved Hide resolved
ding/policy/qgpo.py Outdated Show resolved Hide resolved
self.qt_update_momentum * param.data + (1 - self.qt_update_momentum) * target_param.data
)

q0_loss = q0_loss.detach().cpu().numpy()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

replace detach() by item()

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

ding/policy/qgpo.py Outdated Show resolved Hide resolved
ding/policy/qgpo.py Outdated Show resolved Hide resolved
@@ -611,6 +611,9 @@ def _plot(ctx: "OfflineRLContext"):
)

if ctx.eval_value != -np.inf:
if hasattr(ctx, "info_for_logging"):
info_for_logging.update(ctx.info_for_logging)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

add comment for it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

@PaParaZz1 PaParaZz1 merged commit c2cc99c into opendilab:main Feb 4, 2024
15 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
algo Add new algorithm or improve old one
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants