[BUG] SyncDataCollector Crashes when init_random_frames=0 with a policy that is NOT random #2534
Open
3 tasks done
Labels
bug
Something isn't working
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: