Skip to content

Coerce tensorboard metrics into numpy arrays#21504

Open
pganssle-google wants to merge 15 commits intoLightning-AI:masterfrom
pganssle-google:numpy_scalars
Open

Coerce tensorboard metrics into numpy arrays#21504
pganssle-google wants to merge 15 commits intoLightning-AI:masterfrom
pganssle-google:numpy_scalars

Conversation

@pganssle-google
Copy link
Copy Markdown

@pganssle-google pganssle-google commented Jan 23, 2026

What does this PR do?

As of Numpy 2.4.0, converting an 0-dimensional array to a scalar is now a TypeError, following the expiration of a lengthy deprecation period.

This change detects the situation and adjusts the types accordingly before passing them to tensorboard.

Fixes #21503
closes #21529
closes #21543
closes #21544
closes #21549

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs) No discussion yet.
  • 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 make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

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
  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

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

As of [Numpy
2.4.0](https://numpy.org/doc/stable/release/2.4.0-notes.html#raise-typeerror-on-attempt-to-convert-array-with-ndim-0-to-scalar),
converting an 0-dimensional array to a scalar is now a TypeError,
following the expiration of a lengthy deprecation period.

This change detects the situation and adjusts the types accordingly
before passing them to tensorboard.
@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Jan 24, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 24, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87%. Comparing base (9f074af) to head (17bea2f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #21504   +/-   ##
=======================================
- Coverage      87%      87%   -0%     
=======================================
  Files         270      270           
  Lines       23888    23896    +8     
=======================================
+ Hits        20665    20671    +6     
- Misses       3223     3225    +2     

deependujha
deependujha previously approved these changes Jan 27, 2026
@github-actions github-actions bot added the ci Continuous Integration label Feb 27, 2026
@deependujha
Copy link
Copy Markdown
Collaborator

seems ashtral (uv) is down.

@github-actions github-actions bot added docs Documentation related dependencies Pull requests that update a dependency file labels Mar 19, 2026
@deependujha deependujha added ready to be merged PRs ready to be merged exec-signoff-required PR is fully reviewed and approved by maintainers. Only the CEO's or CTO's approval is pending. labels Mar 19, 2026
@Borda Borda enabled auto-merge (squash) March 19, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous Integration dependencies Pull requests that update a dependency file docs Documentation related exec-signoff-required PR is fully reviewed and approved by maintainers. Only the CEO's or CTO's approval is pending. fabric lightning.fabric.Fabric pl Generic label for PyTorch Lightning package ready to be merged PRs ready to be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tensorboard logging breaks with certain scalar values with numpy >= 2.4.0

3 participants