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

polish(lwq): polish VAE #404

Merged
merged 2 commits into from
Jun 29, 2022
Merged

Conversation

Hcnaeg
Copy link
Contributor

@Hcnaeg Hcnaeg commented Jun 28, 2022

Description

Related Issue

TODO

Check List

  • merge the latest version source branch/repo, and resolve all the conflicts
  • pass style check
  • pass all the tests

@PaParaZz1 PaParaZz1 added the doc Documentation label Jun 28, 2022
@@ -35,6 +41,12 @@ def loss_function(self, *inputs: Any, **kwargs) -> Tensor:


class VanillaVAE(BaseVAE):
"""
Overview:
Implementation of Vanilla variational autoencoder.
Copy link
Member

Choose a reason for hiding this comment

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

Implementation of Vanilla variational autoencoder for action reconstruction

@@ -74,17 +84,23 @@ def __init__(

def encode(self, input) -> Dict[str, Any]:
Copy link
Member

Choose a reason for hiding this comment

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

add python typing for input

@@ -133,15 +147,14 @@ def decode_with_obs(self, z: Tensor, obs: Tensor) -> Dict[str, Any]:
- outputs (:obj:`Dict`): DQN forward outputs, such as q_value.
ReturnsKeys:
- reconstruction_action (:obj:`torch.Tensor`): reconstruction_action.
- predition_residual (:obj:`torch.Tensor`): predition_residual.
- predition_residual (:obj:`torch.Tensor`): prediction_residual.
Copy link
Member

Choose a reason for hiding this comment

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

add more comments

@@ -166,6 +179,21 @@ def reparameterize(self, mu: Tensor, logvar: Tensor) -> Tensor:
return eps * std + mu

def forward(self, input: Tensor, **kwargs) -> dict:
"""
Overview:
encode the input, reparameterize `mu` and `log_var`, decode `obs_encoding`.
Copy link
Member

Choose a reason for hiding this comment

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

Encode

@codecov
Copy link

codecov bot commented Jun 28, 2022

Codecov Report

Merging #404 (ba3db61) into main (63029a4) will increase coverage by 0.22%.
The diff coverage is 100.00%.

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

@@            Coverage Diff             @@
##             main     #404      +/-   ##
==========================================
+ Coverage   85.61%   85.83%   +0.22%     
==========================================
  Files         524      524              
  Lines       41108    41571     +463     
==========================================
+ Hits        35195    35683     +488     
+ Misses       5913     5888      -25     
Flag Coverage Δ
unittests 85.83% <100.00%> (+0.22%) ⬆️

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

Impacted Files Coverage Δ
ding/model/template/vae.py 93.25% <100.00%> (ø)
ding/interaction/tests/test_utils/stream.py 75.00% <0.00%> (-2.78%) ⬇️
ding/framework/tests/test_parallel.py 96.26% <0.00%> (-0.71%) ⬇️
ding/utils/autolog/value.py 100.00% <0.00%> (ø)
ding/utils/loader/string.py 100.00% <0.00%> (ø)
ding/interaction/base/app.py 100.00% <0.00%> (ø)
ding/league/tests/conftest.py 100.00% <0.00%> (ø)
ding/policy/tests/test_cql.py 100.00% <0.00%> (ø)
ding/utils/tests/test_lock.py 100.00% <0.00%> (ø)
ding/utils/tests/test_plot.py 100.00% <0.00%> (ø)
... and 186 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 63029a4...c534fd0. Read the comment docs.

@PaParaZz1 PaParaZz1 merged commit 8a3fba6 into opendilab:main Jun 29, 2022
PaParaZz1 pushed a commit that referenced this pull request Jun 30, 2022
* polish(lwq): polish VAE

* remove base VAE class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants