You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like self._policy_output_keys from SyncDataCollector::_make_final_rollout is set to {} when init_random_frames=0 which causes an unwanted behavior in SyncDataCollector::rollout.
More precisely, these lines from SyncDataCollector::rollout :
In my case, policy_output was a tensor with the action key, but since self._policy_output_keys is {}, this means that self._shuttle is never updated to have the action key. This causes a crash with the error KeyError: "'action' not found in tensordict
Checklist
I have checked that there is no similar issue in the repo (required)
AlexandreBrown
changed the title
[BUG] SyncDataCollector Crashes when policy_device=cuda and init_random_frames=0
[BUG] SyncDataCollector Crashes when init_random_frames=0
Nov 4, 2024
Describe the bug
When yielding from a
SyncDataCollector
that uses a standardActor
(not a random policy) andinit_random_frames=0
, it crashes.Yielding example that causes the crash :
To Reproduce
RandomPolicy
SyncDataCollector
with theactor
and setinit_random_frames=0
.Stack trace:
Expected behavior
We should be able to yield with
init_random_frames = 0
System info
Describe the characteristic of your environment:
pip install torchrl==0.6.0
3.10
pip list
:Reason and Possible fixes
It seems like
self._policy_output_keys
fromSyncDataCollector::_make_final_rollout
is set to{}
wheninit_random_frames=0
which causes an unwanted behavior inSyncDataCollector::rollout
.More precisely, these lines from
SyncDataCollector::rollout
:In my case,
policy_output
was a tensor with theaction
key, but sinceself._policy_output_keys
is{}
, this means thatself._shuttle
is never updated to have the action key. This causes a crash with the errorKeyError: "'action' not found in tensordict
Checklist
The text was updated successfully, but these errors were encountered: