Repository navigation
docs: fix the default devices example in the Fabric arguments page - #22029
Open
ZainnQureshii wants to merge 1 commit into
Open
ZainnQureshii wants to merge 1 commit into
ZainnQureshii wants to merge 1 commit into
Conversation
`Fabric(devices=None)` and `Fabric(devices=0)` were shown as the default, but the default is `devices="auto"`, `0` raises a ValueError and `None` fails CPU device parsing. Show the real default and a valid CPU example instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ZainnQureshii
requested review from
ethanwharris,
justusschock and
tchaton
as code owners
October 19, 2026 15:45
This branch has not been deployed
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.
What does this PR do?
The
devicessection of the Fabric arguments page (docs/source-fabric/api/fabric_args.rst) shows two examples as the default, and neither works:Fabric(devices=None)with the comment "default used by Fabric, i.e., use the CPU". The default isdevices="auto"(src/lightning/fabric/fabric.py:139), andNoneraises aTypeErroron CPU and on GPU/MPS:_parse_cpu_coresrejects it on CPU (src/lightning/fabric/accelerators/cpu.py:98-99) and_check_data_typerejects it for GPU/MPS device IDs (src/lightning/fabric/utilities/device_parser.py:197-199).Fabric(devices=0)with the comment "equivalent"._check_device_config_and_set_final_flagsrejects0with aValueError(src/lightning/fabric/connector.py:305-314).This PR replaces them with
Fabric(devices="auto")for the default andFabric(devices=1, accelerator="cpu")for an explicit CPU run, and adds"auto"to thestrbullet above the block. The comment wording follows the Trainer reference (docs/source-pytorch/common/trainer.rst:429-433).Ran each call against this branch's
src/(dependencies fromlightning2.6.6) on an Apple Silicon Mac (theautoaccelerator picks MPS there), plus the old calls withaccelerator="cpu":The docs build was not run locally.
Docs only, so no linked issue, tests or CHANGELOG entry.
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:
Reviewer checklist
Prepared with AI assistance (Claude Code) and reviewed with GitHub Copilot.
🤖 Generated with Claude Code