Skip to content

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

@Pablomg02

Description

@Pablomg02

Describe the bug

In the rendered documentation of the coding_ppo tutorial, multiprocessing is used in a visible code block but its import is hidden inside a sphinx_gallery_start_ignore / sphinx_gallery_end_ignore block. As a result, any reader copying the visible code will get a NameError.

Affected page: https://docs.pytorch.org/rl/stable/tutorials/coding_ppo.html

To Reproduce

Copy the visible imports block from the tutorial and the hyperparameters section and run them. The line is_fork = multiprocessing.get_start_method() == "fork" raises:

NameError: name 'multiprocessing' is not defined

Expected behavior

The from torch import multiprocessing import should be visible in the rendered documentation, so the tutorial is self-contained and reproducible as presented.

Screenshots

N/A. This is a documentation bug.

System info

N/A. This is a documentation bug, not a code bug.

Additional context

The import exists in the source file tutorials/coding_ppo.py but is wrapped in a sphinx_gallery_start_ignore block, which hides it from the rendered HTML. Moving from torch import multiprocessing outside that block should fix the issue without affecting functionality. I can open a PR if this approach is acceptable.

Reason and Possible fixes

If you know or suspect the reason for this bug, paste the code lines and suggest modifications.

Checklist

  • [X ] I have checked that there is no similar issue in the repo (required)
  • [X ] I have read the documentation (required)
  • [X ] I have provided a minimal working example to reproduce the bug (required)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions