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

[BugFix] Fix missing ("next", "observation") key in dispatch of losses #1235

Merged
merged 3 commits into from
Jun 6, 2023

Conversation

Blonck
Copy link
Contributor

@Blonck Blonck commented Jun 6, 2023

Description

Fix missing ("next", "dispatch") key of in_keys from IQL, DDPG, and A2C loss module.

Types of changes

What types of changes does your code introduce? Remove all that do not apply:

  • Bug fix (non-breaking change which fixes an issue)

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).

@Blonck Blonck requested a review from vmoens June 6, 2023 08:27
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 6, 2023
@Blonck Blonck added bug Something isn't working and removed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Jun 6, 2023
Copy link
Contributor

@vmoens vmoens left a comment

Choose a reason for hiding this comment

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

LGTM
see my minor comment

>>> loss_val
(tensor(1.7593, grad_fn=<MeanBackward0>), tensor(0.2344, grad_fn=<MeanBackward0>), tensor(1.5480), tensor(-0.0155, grad_fn=<MulBackward0>))
(tensor(4.3483, grad_fn=<MeanBackward0>), tensor(1.4114, grad_fn=<MeanBackward0>), tensor(2.5165), tensor(-0.0252, grad_fn=<MulBackward0>))
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we don't want to print these values (such that we don't pollute PRs with diffs that aren't relevant?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I will just remove it.

... next_reward=torch.randn(*batch, 1))
>>> loss_val
(tensor(1.4535, grad_fn=<MeanBackward0>), tensor(0.8389, grad_fn=<MeanBackward0>), tensor(0.3406, grad_fn=<MeanBackward0>), tensor(3.3441))
(tensor(1.4535, grad_fn=<MeanBackward0>), tensor(0.7506, grad_fn=<MeanBackward0>), tensor(0.3406, grad_fn=<MeanBackward0>), tensor(3.3441))
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 6, 2023
Comment on lines 152 to 153
>>> loss_val
(tensor(4.3483, grad_fn=<MeanBackward0>), tensor(1.4114, grad_fn=<MeanBackward0>), tensor(2.5165), tensor(-0.0252, grad_fn=<MulBackward0>))
Copy link
Contributor

Choose a reason for hiding this comment

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

We can still print something :)
You could do

loss_actor, loss_val, *etc = fun_call(**kwargs)
loss_actor.backward() # for instance

anything that makes it feel like "this is a tensor"

Copy link
Contributor

@vmoens vmoens left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

@vmoens vmoens merged commit 9467036 into pytorch:main Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants