pytorch / pytorch/rl

[BUG] Collector deletes new tensordict keys

Open
#1,625 6 comments 0 reactions 1 assignee View on GitHub

@vmoens is already working on this.

Since Oct 10, 2023.

bug
Dominant language
Python
Stars
3.6k
Forks
487
Avg merge
1d 1h
Merged PRs (30d)
207

Description

New Tensordict keys created in policy modules used in the collector are not returned in the rollout tensordict.

The issue is in this line, as setting "out" for torch.stack deletes any new entries which have been created:
https://github.com/pytorch/rl/blob/70c650ec8c946f36fd8d57c11612548da2251128/torchrl/collectors/collectors.py#L877

I did find a workaround, which is to use TensorDictPrimer to create a TransformedEnv that has the new keys that you wish to be saved.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.