Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from tensorboard to tensorboardx in logger #15728

Merged
merged 37 commits into from
Nov 21, 2022
Merged

Switch from tensorboard to tensorboardx in logger #15728

merged 37 commits into from
Nov 21, 2022

Conversation

lantiga
Copy link
Collaborator

@lantiga lantiga commented Nov 18, 2022

What does this PR do?

The tensorboard package used by the TensorBoard logger depends on grpcio, which is creating issues on some systems (no binary builds for M1/M2 macOS on Python > 3.9) or with other packages depending on a different grpcio version (i.e. label-studio).

This PR makes the TensorBoard logger depend on https://github.com/lanpa/tensorboardX instead, which produces equivalent TensorBoard files without extra dependencies apart from numpy and protobuf.

Does your PR introduce any breaking changes? If yes, please list them.

None

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • 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:

  • 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

Did you have fun?

Make sure you had fun coding 🙃

cc @Borda @awaelchli

@lantiga lantiga added this to the v1.8.x milestone Nov 18, 2022
@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Nov 18, 2022
@mergify mergify bot added the ready PRs ready to be merged label Nov 18, 2022
Copy link
Contributor

@carmocca carmocca left a comment

Choose a reason for hiding this comment

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

Happy to make these suggested changes for you if you prefer! Waiting on your greenlight

src/pytorch_lightning/loggers/tensorboard.py Outdated Show resolved Hide resolved
src/pytorch_lightning/loggers/tensorboard.py Outdated Show resolved Hide resolved
requirements/pytorch/test.txt Outdated Show resolved Hide resolved
@lantiga
Copy link
Collaborator Author

lantiga commented Nov 18, 2022

Happy to make these suggested changes for you if you prefer! Waiting on your greenlight

thanks @carmocca, doing now

@Borda Borda enabled auto-merge (squash) November 18, 2022 19:24
Copy link
Member

@justusschock justusschock left a comment

Choose a reason for hiding this comment

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

lgtm in general, it would just be nice to have tests without having full tensorboard installed (which us not tested now since we always install all testing dependencies)

@Borda
Copy link
Member

Borda commented Nov 19, 2022

lgtm in general, it would just be nice to have tests without having full tensorboard installed (which us not tested now since we always install all testing dependencies)

All doctests are called without installing all dependencies

@justusschock
Copy link
Member

that's true but doctests for loggers are meaningless as they only test imports here.

@Borda
Copy link
Member

Borda commented Nov 19, 2022

that's true but doctests for loggers are meaningless as they only test imports here.

So let's add one or we may have elsewhere simple train fit in docstring which would be using default logger...

@mergify mergify bot added the ready PRs ready to be merged label Nov 21, 2022
@Borda
Copy link
Member

Borda commented Nov 21, 2022

They are just meant to decrease the overhead of import pytorch_lightning (see #12786) while still fixing type annotations and tests.

well, you shortened PL import time but then you do an import of TB/TBX is called in the method experiment and log_hyperparams

Also note that my changes were passing on CI

no one is complaining about CI :)

@github-actions
Copy link
Contributor

github-actions bot commented Nov 21, 2022

⚡ Required checks status: All passing 🟢

Groups summary

🟢 pytorch_lightning: Tests workflow
Check ID Status
pl-cpu (macOS-11, pytorch, 3.8, 1.11) success
pl-cpu (macOS-11, pytorch, 3.9, 1.12) success
pl-cpu (macOS-11, pytorch, 3.10, 1.13) success
pl-cpu (macOS-11, pytorch, 3.8, 1.10, oldest) success
pl-cpu (ubuntu-20.04, pytorch, 3.8, 1.10) success
pl-cpu (ubuntu-20.04, pytorch, 3.9, 1.11) success
pl-cpu (ubuntu-20.04, pytorch, 3.10, 1.12) success
pl-cpu (ubuntu-20.04, pytorch, 3.10, 1.13) success
pl-cpu (ubuntu-20.04, pytorch, 3.7, 1.10, oldest) success
pl-cpu (windows-2022, pytorch, 3.9, 1.11) success
pl-cpu (windows-2022, pytorch, 3.10, 1.12) success
pl-cpu (windows-2022, pytorch, 3.10, 1.13) success
pl-cpu (windows-2022, pytorch, 3.7, 1.10, oldest) success
pl-cpu (slow, macOS-11, pytorch, 3.7, 1.11) success
pl-cpu (slow, ubuntu-20.04, pytorch, 3.7, 1.11) success
pl-cpu (slow, windows-2022, pytorch, 3.7, 1.11) success
pl-cpu (macOS-11, lightning, 3.8, 1.13) success
pl-cpu (ubuntu-20.04, lightning, 3.8, 1.13) success
pl-cpu (windows-2022, lightning, 3.8, 1.13) success
🟢 pytorch_lightning: Azure GPU
Check ID Status
pytorch-lightning (GPUs) success
🟢 pytorch_lightning: Benchmarks
Check ID Status
pytorch-lightning.Benchmark success
🟢 pytorch_lightning: Azure HPU
Check ID Status
pytorch-lightning (HPUs) success
🟢 pytorch_lightning: Azure IPU
Check ID Status
pytorch-lightning (IPUs) success
🟢 pytorch_lightning: Docs
Check ID Status
make-doctest (pytorch) success
make-html (pytorch) success
🟢 pytorch_lightning: Docker
Check ID Status
build-cuda (3.9, 1.10, 11.3.1) success
build-cuda (3.9, 1.11, 11.3.1) success
build-cuda (3.9, 1.12, 11.6.1) success
build-cuda (3.9, 1.13, 11.6.1) success
build-hpu (1.5.0, 1.11.0) success
build-ipu (3.9, 1.10) success
build-NGC success
build-pl (3.9, 1.10, 11.3.1) success
build-pl (3.9, 1.11, 11.3.1) success
build-pl (3.9, 1.12, 11.6.1) success
build-pl (3.9, 1.13, 11.6.1) success
build-xla (3.7, 1.12) success
🟢 mypy
Check ID Status
mypy success
🟢 install
Check ID Status
install-pkg (ubuntu-22.04, app, 3.7) success
install-pkg (ubuntu-22.04, app, 3.10) success
install-pkg (ubuntu-22.04, lite, 3.7) success
install-pkg (ubuntu-22.04, lite, 3.10) success
install-pkg (ubuntu-22.04, pytorch, 3.7) success
install-pkg (ubuntu-22.04, pytorch, 3.10) success
install-pkg (ubuntu-22.04, lightning, 3.7) success
install-pkg (ubuntu-22.04, lightning, 3.10) success
install-pkg (macOS-12, app, 3.7) success
install-pkg (macOS-12, app, 3.10) success
install-pkg (macOS-12, lite, 3.7) success
install-pkg (macOS-12, lite, 3.10) success
install-pkg (macOS-12, pytorch, 3.7) success
install-pkg (macOS-12, pytorch, 3.10) success
install-pkg (macOS-12, lightning, 3.7) success
install-pkg (macOS-12, lightning, 3.10) success
install-pkg (windows-2022, app, 3.7) success
install-pkg (windows-2022, app, 3.10) success
install-pkg (windows-2022, lite, 3.7) success
install-pkg (windows-2022, lite, 3.10) success
install-pkg (windows-2022, pytorch, 3.7) success
install-pkg (windows-2022, pytorch, 3.10) success
install-pkg (windows-2022, lightning, 3.7) success
install-pkg (windows-2022, lightning, 3.10) success

This comment was automatically generated and updates for 60 minutes every 180 seconds.

Thank you for your contribution! 💜

@Borda Borda disabled auto-merge November 21, 2022 19:43
@Borda Borda enabled auto-merge (squash) November 21, 2022 19:43
@Borda Borda merged commit 9c2eb52 into master Nov 21, 2022
@Borda Borda deleted the tensorboardx branch November 21, 2022 20:53
Borda pushed a commit that referenced this pull request Nov 21, 2022
* Switch from tensorboard to tensorboardx in logger
* Warn if log_graph is set to True but tensorboard is not installed
* Fix warning message formatting
* Apply suggestions from code review
* simplify for TBX as required pkg
* docs example
* chlog
* tbx 2.2

Co-authored-by: Luca Antiga <luca@lightning.ai>
Co-authored-by: William Falcon <waf2107@columbia.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Co-authored-by: Jirka <jirka.borovec@seznam.cz>

(cherry picked from commit 9c2eb52)
lantiga added a commit that referenced this pull request Nov 23, 2022
* chlog update

* Fix typo in script name (#15724)

(cherry picked from commit d925077)

* Torch inference mode for prediction (#15719)

torch inference mode for prediction

(cherry picked from commit 08d14ec)

* [App] Update multi-node examples (#15700)

Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
(cherry picked from commit 8306797)

* feature(docs/app/lit_tabs): add works (#15731)

(cherry picked from commit 1a31d13)

* [App] Fix VSCode IDE debugger (#15747)

(cherry picked from commit 6714ca7)

* Update tensorboard requirement from <2.11.0,>=2.9.1 to >=2.9.1,<2.12.0 in /requirements (#15746)

Update tensorboard requirement in /requirements

Updates the requirements on [tensorboard](https://github.com/tensorflow/tensorboard) to permit the latest version.
- [Release notes](https://github.com/tensorflow/tensorboard/releases)
- [Changelog](https://github.com/tensorflow/tensorboard/blob/master/RELEASE.md)
- [Commits](tensorflow/tensorboard@2.9.1...2.11.0)

---
updated-dependencies:
- dependency-name: tensorboard
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit 0b58b69)

* Update beautifulsoup4 requirement from <=4.8.2 to <4.11.2 in /requirements (#15745)

* Update beautifulsoup4 requirement in /requirements

Updates the requirements on [beautifulsoup4](https://www.crummy.com/software/BeautifulSoup/bs4/) to permit the latest version.

---
updated-dependencies:
- dependency-name: beautifulsoup4
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply suggestions from code review

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
(cherry picked from commit 1ffbe1b)

* [App] Fix multi-node pytorch example CI (#15753)

(cherry picked from commit bc797fd)

* [App] Improve `LightningTrainerScript` start-up time (#15751)

(cherry picked from commit c2c1974)

* Enable Probot CheckGroup v5 (#15670)

(cherry picked from commit 6c8ee01)

* [App] Enable properties for the Lightning flow (#15750)

(cherry picked from commit 5cfb176)

* test for Enable setting property (#15755)

Co-authored-by: thomas chaton <thomas@grid.ai>
Co-authored-by: Ethan Harris <ethanwharris@gmail.com>
(cherry picked from commit ba14038)

* Move s3fs to cloud extras (#15729)

Co-authored-by: Luca Antiga <luca@lightning.ai>
(cherry picked from commit dd75906)

* Revert new Hydra launch behavior (#15737)

* revert new hydra cwd behavior
* remove debug statements
* changelog

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jirka <jirka.borovec@seznam.cz>
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>

(cherry picked from commit 88b2e5a)

* FCCV Docs (#15598)

* add custom data iter docs

* add custom data iter docs

* Update docs/source-pytorch/data/custom_data_iterables.rst

* remove ToDevice

* nit

* Update docs/source-pytorch/data/custom_data_iterables.rst

Co-authored-by: Luca Antiga <luca.antiga@gmail.com>

* clarification for @lantiga

* typo

* Update docs/source-pytorch/data/custom_data_iterables.rst

* Update docs/source-pytorch/data/custom_data_iterables.rst

* Update docs/source-pytorch/data/custom_data_iterables.rst

Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Co-authored-by: Akihiro Nitta <nitta@akihironitta.com>
Co-authored-by: Luca Antiga <luca.antiga@gmail.com>
(cherry picked from commit 006fde9)

* Switch from tensorboard to tensorboardx in logger (#15728)

* Switch from tensorboard to tensorboardx in logger
* Warn if log_graph is set to True but tensorboard is not installed
* Fix warning message formatting
* Apply suggestions from code review
* simplify for TBX as required pkg
* docs example
* chlog
* tbx 2.2

Co-authored-by: Luca Antiga <luca@lightning.ai>
Co-authored-by: William Falcon <waf2107@columbia.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Co-authored-by: Jirka <jirka.borovec@seznam.cz>

(cherry picked from commit 9c2eb52)

* resolve conflicts

* Fix azure path excludes (#15756)

Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
(cherry picked from commit aef94ce)

* Disable XSRF protection in StreamlitFrontend to support upload in localhost (#15684)

* Enable CORS in StreamlitFrontend to support upload
* Only disable XSRF when running on localhost
* Update test
* Use utility fn to detect if localhost

Co-authored-by: Luca Antiga <luca@lightning.ai>
(cherry picked from commit ed3eef0)

* Enable Probot CheckGroup v5.1 (#15763)

(cherry picked from commit c55f80f)

* Bump pytest from 7.1.3 to 7.2.0 in /requirements (#15677)

Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.1.3 to 7.2.0.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](pytest-dev/pytest@7.1.3...7.2.0)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit cfb27bd)

* Fix the `examples/app_dag` App (#14359)

* Fix app dag example
* Add test
* Update doc
* Update tests/tests_app_examples/test_app_dag.py

Co-authored-by: Sherin Thomas <sherin@grid.ai>
(cherry picked from commit 2b61c92)

* mergify: drop ready for draft (#15766)

(cherry picked from commit 1a07a9c)

* lightning delete cluster CLI command help text update (#15760)

* updated the lighting delete cluster CLI command help text output
* updated changelog
* typo fix
* Apply suggestions from code review

Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
(cherry picked from commit 75b0573)

* Deduplicate top level lighting CLI command groups (#15761)

* unify remove and delete command groups & the add and delete command groups
* added changelog
* fix tests
* Apply suggestions from code review

Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
(cherry picked from commit 7b2788e)

* releasing 1.8.3

* CI: lite on GPU

* Fix App Docs for lightning ssh-keys command (#15773)

fixed ssh-keys docs

(cherry picked from commit 317591d)

Co-authored-by: thomas chaton <thomas@grid.ai>
Co-authored-by: yiftachbeer <yiftach.beer@gmail.com>
Co-authored-by: Sherin Thomas <sherin@lightning.ai>
Co-authored-by: Ethan Harris <ethanwharris@gmail.com>
Co-authored-by: Yurij Mikhalevich <yurij@grid.ai>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
Co-authored-by: Luca Antiga <luca.antiga@gmail.com>
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
Co-authored-by: Kaushik B <45285388+kaushikb11@users.noreply.github.com>
Co-authored-by: Rick Izzo <rlizzo@users.noreply.github.com>
@Borda Borda mentioned this pull request Nov 23, 2022
@leoleoasd
Copy link
Contributor

leoleoasd commented Jan 10, 2023

This PR breaks remote file system support as it seems that tensorboardX doesn't support fsspec.
image

@carmocca
Copy link
Contributor

carmocca commented Jan 10, 2023

@leoleoasd If you install the 1.9 release candidate (or master), you can pip install tensorboard and then the logger will choose it over tensorboardX. Support for that was added in #15762 but it was not cherry-picked into a 1.8.x release.

@leoleoasd
Copy link
Contributor

Ok, thanks @carmocca!
However:

  1. should we clearly document this in the remote filesystem section of the document?
  2. it was said that this is currently a temporary solution (loggers: revert useless exception #15789 (comment)). Will we still have fsspec support for the "permanent" version?

@carmocca
Copy link
Contributor

carmocca commented Jan 10, 2023

  1. Yes, this would be a useful note. Would you like to open a PR with the docs change?
  2. Remote support is important for us, so we will look to support fsspec as much as we can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logger: tensorboard pl Generic label for PyTorch Lightning package ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants