Skip to content

Docs: avoid unresolved torch.jit Sphinx refs to fix the CICD doc build failure.#21621

Merged
tchaton merged 1 commit intoLightning-AI:masterfrom
littlebullGit:fix/21616-docs-torch-jit-refs
Mar 30, 2026
Merged

Docs: avoid unresolved torch.jit Sphinx refs to fix the CICD doc build failure.#21621
tchaton merged 1 commit intoLightning-AI:masterfrom
littlebullGit:fix/21616-docs-torch-jit-refs

Conversation

@littlebullGit
Copy link
Copy Markdown
Contributor

@littlebullGit littlebullGit commented Mar 28, 2026

What does this PR do?

Fixes #21620

This PR fixes the docs build failure caused by unresolved Sphinx cross-references in LightningModule.to_torchscript().

The immediate source of the warnings is Lightning's docstring in src/lightning/pytorch/core/module.py, which references deprecated torch.jit objects with Sphinx roles:

  • torch.jit.ScriptModule
  • torch.jit.script
  • torch.jit.trace
  • torch.jit

These references appear to have become unresolved after upstream PyTorch documentation / intersphinx changes following TorchScript deprecation.

This change keeps the fix targeted by replacing only those broken external torch.jit Sphinx roles with code literals. Other working cross-references remain unchanged.

No breaking changes.

Before submitting
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you verify new and existing tests pass locally with your changes?

Local verification:

  • ./.venv/bin/python -m py_compile src/lightning/pytorch/core/module.py

📚 Documentation preview 📚: https://pytorch-lightning--21621.org.readthedocs.build/en/21621/

@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Mar 28, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79%. Comparing base (6805188) to head (e9a69b7).
⚠️ Report is 9 commits behind head on master.
✅ All tests successful. No failed tests found.

❗ There is a different number of reports uploaded between BASE (6805188) and HEAD (e9a69b7). Click for more details.

HEAD has 3547 uploads less than BASE
Flag BASE (6805188) HEAD (e9a69b7)
cpu 835 42
python 60 3
lightning_fabric 268 0
pytest 418 0
python3.12 239 12
python3.13 176 9
python3.12.7 180 9
lightning 300 15
python3.10 60 3
python3.11 120 6
pytorch2.1 60 6
pytest-full 417 42
pytorch2.4.1 30 3
pytorch_lightning 267 27
pytorch2.10 59 6
pytorch2.2.2 30 3
pytorch2.8 60 6
pytorch2.3 30 3
pytorch2.6 30 3
pytorch2.7 29 3
pytorch2.9 59 6
pytorch2.5.1 30 3
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #21621     +/-   ##
=========================================
- Coverage      87%      79%     -8%     
=========================================
  Files         270      267      -3     
  Lines       23895    23836     -59     
=========================================
- Hits        20675    18762   -1913     
- Misses       3220     5074   +1854     

@littlebullGit littlebullGit changed the title Docs: avoid unresolved torch.jit Sphinx refs Docs: avoid unresolved torch.jit Sphinx refs to fix the CICD doc build failure. Mar 28, 2026
@tchaton tchaton merged commit 44fd142 into Lightning-AI:master Mar 30, 2026
106 checks passed
provided, or the model has :attr:`example_input_array` set. If you would like to customize the modules that are
scripted you should override this method. In case you want to return multiple modules, we recommend using a
dictionary.
"""By default compiles the whole model to a ``torch.jit.ScriptModule``. If you want to use tracing, please
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.

Copy link
Copy Markdown
Collaborator

@bhimrazy bhimrazy Mar 30, 2026

Choose a reason for hiding this comment

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

I think this pr is probably better anyway, since it was coming from deprecated code. I actually remembered the ignore approach from your PR as well.

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.

in that case, either this method should be discouraged, or removed completely.

deependujha added a commit to deependujha/pytorch-lightning that referenced this pull request Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pl Generic label for PyTorch Lightning package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs build fails on unresolved torch.jit cross-references in LightningModule.to_torchscript

4 participants