Skip to content

[BugFix] Fix hidden multiprocessing import in coding_ppo tutorial#3779

Merged
vmoens merged 3 commits into
pytorch:mainfrom
coder-jayp:fix/coding-ppo-multiprocessing-import
Jun 3, 2026
Merged

[BugFix] Fix hidden multiprocessing import in coding_ppo tutorial#3779
vmoens merged 3 commits into
pytorch:mainfrom
coder-jayp:fix/coding-ppo-multiprocessing-import

Conversation

@coder-jayp

Copy link
Copy Markdown
Contributor

Description

Moved the from torch import multiprocessing import outside the sphinx_gallery_start_ignore section in tutorials/sphinx-tutorials/coding_ppo.py so that it is visible in the rendered documentation.

Motivation and Context

This was a documentation bug. The tutorial was not self-contained. Readers who copied the visible code from the documentation would encounter a NameError because the import was hidden.

This fix makes the tutorial reproducible when users copy code directly from the documentation.

Fixes #3778

Types of changes

What types of changes does your code introduce?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds core functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)
  • Example (update in the folder of examples)

Checklist

  • I have read the CONTRIBUTION guide (required)
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature)
  • I have updated the documentation accordingly.

@pytorch-bot

pytorch-bot Bot commented May 19, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/3779

Note: Links to docs will display an error until the docs builds have been completed.

⏳ 7 Pending, 1 Unrelated Failure

As of commit d198aae with merge base 7155a0b (image):

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla 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 May 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ PR Title Label Error

PR title must start with a label prefix in brackets (e.g., [BugFix]).

Current title: Fix hidden multiprocessing import in coding_ppo tutorial

Supported Prefixes (case-sensitive)

Your PR title must start with exactly one of these prefixes:

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]).

@coder-jayp coder-jayp force-pushed the fix/coding-ppo-multiprocessing-import branch from 961a0de to 399c6c7 Compare May 19, 2026 06:14
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ PR Title Label Error

PR title must start with a label prefix in brackets (e.g., [BugFix]).

Current title: Fix hidden multiprocessing import in coding_ppo tutorial

Supported Prefixes (case-sensitive)

Your PR title must start with exactly one of these prefixes:

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]).

@coder-jayp coder-jayp changed the title Fix hidden multiprocessing import in coding_ppo tutorial [BugFix] Fix hidden multiprocessing import in coding_ppo tutorial May 19, 2026

@vmoens vmoens left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks

The 'from torch import multiprocessing' import was hidden inside
a sphinx_gallery_start_ignore section. This caused a NameError when
users copied the visible code from the documentation.
@coder-jayp coder-jayp force-pushed the fix/coding-ppo-multiprocessing-import branch from 399c6c7 to 22e9873 Compare May 19, 2026 10:30
@vmoens vmoens merged commit dd633fb into pytorch:main Jun 3, 2026
103 of 109 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BugFix CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. tutorials/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] coding_ppo tutorial: multiprocessing import hidden from visible code blocks causes NameError

2 participants