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

Refactor multi-env / multiprocessing seeding logic to make it uncorrelated across runs #182

Merged

Conversation

hojthehedgehog
Copy link
Contributor

Resolves issue #129

@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 2, 2022
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.

Just a couple of comments but looks like we're on the right track!

test/test_collector.py Outdated Show resolved Hide resolved
torchrl/__init__.py Outdated Show resolved Hide resolved
torchrl/__init__.py Outdated Show resolved Hide resolved
@vmoens vmoens added the enhancement New feature or request label Jun 3, 2022
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.

Sorry meant to ask for changes :)

@vmoens vmoens changed the title 129_enhance_multiprocessing_seeding_logic Refactor multi-env / multiprocessing seeding logic to make it uncorrelated across runs Jun 3, 2022
@hojthehedgehog
Copy link
Contributor Author

@vmoens

I made some logic change and most of unit tests pass.
In test_collector unit test, the following two test sets fail.

FAILED test/test_collector.py::test_collector_consistency[conv-3] - AssertionError: key done does not match, got mse = 0.5774 key action does not match, got mse = 0.0000
FAILED test/test_collector.py::test_collector_consistency[vec-3] - AssertionError: key done does not match, got mse = 0.5774 key action does not match, got mse = 0.0000
FAILED test/test_collector.py::test_traj_len_consistency[conv-SyncDataCollector-3] - RuntimeError: The size of tensor a (20) must match the size of tensor b (2) at non-singleton dimension 1
FAILED test/test_collector.py::test_traj_len_consistency[conv-aSyncDataCollector-3] - RuntimeError: At least on process failed. Check for more infos in the log.
FAILED test/test_collector.py::test_traj_len_consistency[vec-SyncDataCollector-3] - RuntimeError: The size of tensor a (20) must match the size of tensor b (2) at non-singleton dimension 1
FAILED test/test_collector.py::test_traj_len_consistency[vec-aSyncDataCollector-3] - RuntimeError: At least on process failed. Check for more infos in the log.

I think it fails because of this line in mock class.
https://github.com/facebookresearch/rl/blob/fc7876666fa0c6733a4b272aa7cfc5b997bc2e04/test/mocking_classes.py#L72
For instance, I change this line to self.count = 100 test passes.
Can you please explain what this line does and suggest best way to update this line?

Thank you,
Hojin

@hojthehedgehog hojthehedgehog force-pushed the 129_enhance_multiprocessing_seeding_logic branch from 2dc4537 to 5a8241e Compare June 6, 2022 16:00
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.

Some comments to understand better what's going on :)

test/test_helpers.py Outdated Show resolved Hide resolved
test/test_helpers.py Outdated Show resolved Hide resolved
test/test_helpers.py Outdated Show resolved Hide resolved
torchrl/collectors/collectors.py Show resolved Hide resolved
torchrl/envs/vec_env.py Outdated Show resolved Hide resolved
torchrl/envs/vec_env.py Show resolved Hide resolved
@hojthehedgehog hojthehedgehog force-pushed the 129_enhance_multiprocessing_seeding_logic branch from eb014f6 to 64593a3 Compare June 7, 2022 03:18
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.

Amazing work!
Let's fix the 2 things I pointed and we're good to go!!

test/test_helpers.py Outdated Show resolved Hide resolved
torchrl/envs/vec_env.py Outdated Show resolved Hide resolved
torchrl/envs/vec_env.py Outdated Show resolved Hide resolved
@hojthehedgehog hojthehedgehog force-pushed the 129_enhance_multiprocessing_seeding_logic branch from 64593a3 to ab3622a Compare June 7, 2022 13:12
@hojthehedgehog hojthehedgehog force-pushed the 129_enhance_multiprocessing_seeding_logic branch from ab3622a to 78e41e4 Compare June 7, 2022 13:19
@vmoens vmoens merged commit 3902e43 into pytorch:main Jun 7, 2022
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. enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor multi-env / multiprocessing seeding logic to make it uncorrelated across runs
3 participants