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

[Doc] Minor fixes to the docs and type hints #2548

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

thomasbbrunner
Copy link
Contributor

Description

Minor improvements to the documentation and type hints of the environment code.

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)
  • 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)
  • Example (update in the folder of examples)

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.

Copy link

pytorch-bot bot commented Nov 11, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/2548

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@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 Nov 11, 2024
@@ -516,7 +516,7 @@ def append_transform(
self,
transform: "Transform" # noqa: F821
| Callable[[TensorDictBase], TensorDictBase],
) -> None:
) -> EnvBase:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should actually return TransformedEnv.

However, I'm guessing we don't want to import it at the top to prevent loading a lot of modules that won't be accessed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Either EnvBase or "torchrl.envs.TransformedEnv" but we can't import it
EnvBase could be the best compromise!

Comment on lines -2396 to -2469
auto_reset (bool, optional): if ``True``, resets automatically the environment
if it is in a done state when the rollout is initiated.
Default is ``True``.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO this docstring was wrong and caused some confusion on our side. I hope that I was able to get the correct meaning of this argument.

Copy link
Contributor

Choose a reason for hiding this comment

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

That looks great!

Comment on lines -2401 to -2474
break_when_any_done (bool): breaks if any of the done state is True. If False, a reset() is
called on the sub-envs that are done. Default is True.
break_when_all_done (bool): TODO
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Took the liberty of adding a docstring here and making some things a bit clearer. Open to suggestions for improvements!

Copy link
Contributor

Choose a reason for hiding this comment

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

haha yeah much better!
200w

@vmoens vmoens added documentation Improvements or additions to documentation quality code quality labels Nov 11, 2024
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!

@@ -516,7 +516,7 @@ def append_transform(
self,
transform: "Transform" # noqa: F821
| Callable[[TensorDictBase], TensorDictBase],
) -> None:
) -> EnvBase:
Copy link
Contributor

Choose a reason for hiding this comment

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

Either EnvBase or "torchrl.envs.TransformedEnv" but we can't import it
EnvBase could be the best compromise!

Comment on lines -2396 to -2469
auto_reset (bool, optional): if ``True``, resets automatically the environment
if it is in a done state when the rollout is initiated.
Default is ``True``.
Copy link
Contributor

Choose a reason for hiding this comment

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

That looks great!

Comment on lines -2401 to -2474
break_when_any_done (bool): breaks if any of the done state is True. If False, a reset() is
called on the sub-envs that are done. Default is True.
break_when_all_done (bool): TODO
Copy link
Contributor

Choose a reason for hiding this comment

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

haha yeah much better!
200w

@vmoens vmoens changed the title Minor fixes to the docs and type hints [Doc] Minor fixes to the docs and type hints Nov 11, 2024
@vmoens vmoens force-pushed the tbrunner/minor-docs-typing branch from 15e5965 to 5c5ebd0 Compare November 11, 2024 12:59
@vmoens vmoens force-pushed the tbrunner/minor-docs-typing branch from 5c5ebd0 to 91d2c07 Compare November 11, 2024 12:59
@vmoens vmoens merged commit 50a35f6 into pytorch:main Nov 11, 2024
1 check passed
albertbou92 pushed a commit to PyTorchRL/rl that referenced this pull request Nov 11, 2024
vmoens pushed a commit that referenced this pull request Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. documentation Improvements or additions to documentation quality code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants