Skip to content

Conversation

@KAVYANSHTYAGI
Copy link
Contributor

@KAVYANSHTYAGI KAVYANSHTYAGI commented Jun 4, 2025

What does this PR do?

Improves the test coverage for TensorBoardLogger by enhancing the test_tensorboard_log_graph suite:

 Adds parameterization to test both torch.nn.Module and lightning.pytorch.LightningModule via BoringModel from demos.boring_classes.

  Verifies that log_graph works correctly when the model is wrapped using _FabricModule.

  Confirms that batch_transfer_handler methods (_on_before_batch_transfer and _apply_batch_transfer_handler) are triggered during logging.

   Adds a descriptive skip reason for tests when TensorBoard is not available, to improve CI/debugging clarity.

This change ensures more robust and realistic validation of the logging graph functionality, especially for models that go through Fabric’s module wrapping and transfer pipeline.

Was this discussed/agreed via a GitHub issue? (not for typos and docs)no

Did you read the contributor guideline, Pull Request section?yes

Did you make sure your PR does only one thing, instead of bundling different changes together?yes

Did you make sure to update the documentation with your changes? (if necessary)no

Did you write any new necessary tests? (not for typos and docs)no

Did you verify new and existing tests pass locally with your changes?yes

Did you list all the breaking changes introduced by this pull request?yes

Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)no

PR review

Anyone in the community is welcome to review the PR.


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

@github-actions github-actions bot added the fabric lightning.fabric.Fabric label Jun 4, 2025
@codecov
Copy link

codecov bot commented Jun 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49%. Comparing base (ab7b118) to head (f36050e).
⚠️ Report is 205 commits behind head on master.

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

HEAD has 1075 uploads less than BASE
Flag BASE (ab7b118) HEAD (f36050e)
cpu 263 27
python 30 3
lightning_fabric 60 14
pytest 135 30
python3.12.7 88 9
python3.10 58 6
lightning 147 16
python3.12 29 3
python3.11 58 6
pytorch2.1 29 0
pytorch_lightning 59 0
pytest-full 131 0
pytorch2.2.2 15 0
pytorch2.3 13 0
pytorch2.5 15 0
pytorch2.7 15 0
pytorch2.4.1 15 0
pytorch2.6 14 0
pytorch2.5.1 15 0
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #20874     +/-   ##
=========================================
- Coverage      87%      49%    -38%     
=========================================
  Files         268      265      -3     
  Lines       23414    23358     -56     
=========================================
- Hits        20363    11407   -8956     
- Misses       3051    11951   +8900     

Copy link
Contributor Author

@KAVYANSHTYAGI KAVYANSHTYAGI left a comment

Choose a reason for hiding this comment

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

One test now covers plain nn.Module and _FabricModule cases.

The other focuses on LightningModule with batch transfer hooks.

@Borda
Copy link
Collaborator

Borda commented Jun 11, 2025

perfect, thank you @KAVYANSHTYAGI

@Borda Borda merged commit 43691d4 into Lightning-AI:master Jun 11, 2025
70 of 73 checks passed
Borda pushed a commit that referenced this pull request Jun 19, 2025
* test: enhance tensorboard log graph
* Update test_tensorboard.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
(cherry picked from commit 43691d4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fabric lightning.fabric.Fabric

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants