Skip to content

Conversation

@vmoens
Copy link
Collaborator

@vmoens vmoens commented Dec 16, 2022

Description

Introduces the FrameSkipTransform
Refactors the transformed environment parent by adding a caching mechanism.
Tests that the cache is emptied whenever the transform list is changed.

cc @albertbou92 any other idea of changes in the transformed env that might break the caching of the parent (have a look at the test).

Maybe we'd like to allow

env = TransformedEnv(base_env, transform1)
env.transform = transform2
assert transform1.parent.base_env is not env # should not be env because we have done a substitution

which I think now would break

EDIT

I now made this possible

@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 Dec 16, 2022
@vmoens vmoens marked this pull request as draft December 16, 2022 11:06
@codecov
Copy link

codecov bot commented Dec 22, 2022

Codecov Report

Merging #749 (a8d0f34) into main (427c89d) will increase coverage by 12.79%.
The diff coverage is 95.45%.

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

@@             Coverage Diff             @@
##             main     #749       +/-   ##
===========================================
+ Coverage   76.01%   88.80%   +12.79%     
===========================================
  Files         123      123               
  Lines       20904    20886       -18     
===========================================
+ Hits        15890    18548     +2658     
+ Misses       5014     2338     -2676     
Flag Coverage Δ
habitat-gpu 25.13% <11.39%> (+0.16%) ⬆️
linux-brax 29.46% <11.39%> (-0.13%) ⬇️
linux-cpu 85.36% <95.45%> (?)
linux-gpu 86.27% <95.45%> (?)
linux-jumanji 30.18% <11.39%> (-0.18%) ⬇️
linux-outdeps-gpu 71.92% <57.79%> (-0.10%) ⬇️
linux-stable-cpu 85.21% <95.45%> (?)
linux-stable-gpu 85.91% <95.45%> (?)
linux_examples-gpu 43.00% <62.02%> (+0.05%) ⬆️
macos-cpu 85.04% <95.45%> (?)
olddeps-gpu 76.02% <92.85%> (?)

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

Impacted Files Coverage Δ
torchrl/envs/transforms/__init__.py 100.00% <ø> (ø)
torchrl/envs/transforms/functional.py 75.00% <ø> (ø)
torchrl/envs/transforms/transforms.py 87.35% <90.41%> (+3.91%) ⬆️
test/test_transforms.py 96.56% <100.00%> (+26.70%) ⬆️
torchrl/envs/common.py 83.93% <100.00%> (+7.86%) ⬆️
torchrl/envs/libs/dm_control.py 84.83% <100.00%> (+10.35%) ⬆️
torchrl/collectors/utils.py 76.31% <0.00%> (-0.61%) ⬇️
torchrl/envs/libs/jumanji.py 90.47% <0.00%> (-0.28%) ⬇️
test/test_postprocs.py 97.56% <0.00%> (ø)
torchrl/envs/libs/brax.py 92.15% <0.00%> (ø)
... and 47 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@vmoens vmoens changed the title [Feature, WIP] FrameSkipTransform [Feature] FrameSkipTransform Dec 23, 2022
@vmoens vmoens added the enhancement New feature or request label Dec 23, 2022
@vmoens vmoens marked this pull request as ready for review December 23, 2022 09:31
# Conflicts:
#	torchrl/envs/libs/dm_control.py
@vmoens vmoens merged commit 7fcbac8 into main Dec 23, 2022
@vmoens vmoens deleted the frame_skip_transform branch March 31, 2023 16:01
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.

3 participants