[Feature] collectors internals docs#3796
Open
theap06 wants to merge 2 commits into
Open
Conversation
Adds the architecture/internals layer between API reference and tutorials that contributors and debuggers have been missing for the collector and key TorchRL-specific vocabulary. - New collectors_internals.rst: per-timestep rollout flow diagram, carrier (formerly "shuttle") lifecycle, the three sync points (_sync_policy / _sync_env / _sync_storage), and the device-cast flags (_cast_to_policy_device / _cast_to_env_device / _shuttle_has_no_device). - New glossary.rst with entries for carrier/shuttle, in_keys/out_keys, _AcceptedKeys, set_keys, recurrent mode, TensorDictPrimer, is_init, trajectory ID, storing/policy/env_device, no_cuda_sync, compact_obs, functional loss, tensor_keys. - Expanded SyncDataCollector.rollout docstring with a 5-bullet high-level outline of the per-timestep flow, cross-linking to the new internals page. - collectors_basics.rst gains a track_traj_ids paragraph and a short Trajectory IDs section explaining the downstream consumers (SliceSampler, split_trajectories). - Both new pages wired into the corresponding toctrees. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three factual corrections in the glossary's `recurrent mode` entry: - Removed reference to ``LSTMModule.set_recurrent_mode``, which was removed in v0.8 (the method now raises and redirects users to the standalone context manager). - Clarified that ``recurrent_mode_state_manager`` is the backing singleton, not a context manager — the context manager is ``set_recurrent_mode``. Noted the thread / asyncio-task locality via ``contextvars.ContextVar``. - Fixed the sequential/recurrent label swap: collectors run in sequential mode (one step per call), losses in recurrent mode (full sequence per call).
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/3796
Note: Links to docs will display an error until the docs builds have been completed.
|
Contributor
|
| Prefix | Label Applied | Example |
|---|---|---|
[BugFix] |
BugFix | [BugFix] Fix memory leak in collector |
[Feature] |
Feature | [Feature] Add new optimizer |
[Doc] or [Docs] |
Documentation | [Doc] Update installation guide |
[Refactor] |
Refactoring | [Refactor] Clean up module imports |
[CI] |
CI | [CI] Fix workflow permissions |
[Test] or [Tests] |
Tests | [Tests] Add unit tests for buffer |
[Environment] or [Environments] |
Environments | [Environments] Add Gymnasium support |
[Data] |
Data | [Data] Fix replay buffer sampling |
[Performance] or [Perf] |
Performance | [Performance] Optimize tensor ops |
[BC-Breaking] |
bc breaking | [BC-Breaking] Remove deprecated API |
[Deprecation] |
Deprecation | [Deprecation] Mark old function |
[Quality] |
Quality | [Quality] Fix typos and add codespell |
Note: Common variations like singular/plural are supported (e.g., [Doc] or [Docs]).
Contributor
|
| Prefix | Label Applied | Example |
|---|---|---|
[BugFix] |
BugFix | [BugFix] Fix memory leak in collector |
[Feature] |
Feature | [Feature] Add new optimizer |
[Doc] or [Docs] |
Documentation | [Doc] Update installation guide |
[Refactor] |
Refactoring | [Refactor] Clean up module imports |
[CI] |
CI | [CI] Fix workflow permissions |
[Test] or [Tests] |
Tests | [Tests] Add unit tests for buffer |
[Environment] or [Environments] |
Environments | [Environments] Add Gymnasium support |
[Data] |
Data | [Data] Fix replay buffer sampling |
[Performance] or [Perf] |
Performance | [Performance] Optimize tensor ops |
[BC-Breaking] |
bc breaking | [BC-Breaking] Remove deprecated API |
[Deprecation] |
Deprecation | [Deprecation] Mark old function |
[Quality] |
Quality | [Quality] Fix typos and add codespell |
Note: Common variations like singular/plural are supported (e.g., [Doc] or [Docs]).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3746
Summary
Adds the architecture / internals layer between the API reference and tutorials that contributors and debuggers have been missing for the collector subsystem and TorchRL-specific vocabulary. Docs-only. No runtime changes.
Targets the gap where
SyncDataCollector's per-step mechanics (_carrier, the three sync points, the device-cast flags) are load-bearing for anyone debugging RNN, replay, or device-placement issues but have until now only lived in inline comments insidetorchrl/collectors/_single.py.