Skip to content

Conversation

Borda
Copy link
Member

@Borda Borda commented Jan 17, 2023

What does this PR do?

replace the rather more robust way of obtaining log_dir
see failing legacy testing: https://github.com/Lightning-AI/lightning/actions/runs/3938658456/jobs/6737646117

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 @awaelchli @Borda @Blaizzy @tchaton

@Borda Borda added bug Something isn't working logger Related to the Loggers priority: 1 Medium priority task labels Jan 17, 2023
@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Jan 17, 2023
@Borda Borda requested review from lantiga, akihironitta and a team January 17, 2023 13:34
@Borda Borda enabled auto-merge (squash) January 17, 2023 13:35
@github-actions
Copy link
Contributor

github-actions bot commented Jan 17, 2023

⚡ 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

These checks are required after the changes to .github/workflows/ci-tests-pytorch.yml, src/pytorch_lightning/callbacks/model_checkpoint.py, src/pytorch_lightning/loggers/csv_logs.py, src/pytorch_lightning/trainer/trainer.py.

🟢 pytorch_lightning: Azure GPU
Check ID Status
pytorch-lightning (GPUs) success

These checks are required after the changes to src/pytorch_lightning/callbacks/model_checkpoint.py, src/pytorch_lightning/loggers/csv_logs.py, src/pytorch_lightning/trainer/trainer.py.

🟢 pytorch_lightning: Azure HPU
Check ID Status
pytorch-lightning (HPUs) success

These checks are required after the changes to src/pytorch_lightning/callbacks/model_checkpoint.py, src/pytorch_lightning/loggers/csv_logs.py, src/pytorch_lightning/trainer/trainer.py.

🟢 pytorch_lightning: Azure IPU
Check ID Status
pytorch-lightning (IPUs) success

These checks are required after the changes to src/pytorch_lightning/callbacks/model_checkpoint.py, src/pytorch_lightning/loggers/csv_logs.py, src/pytorch_lightning/trainer/trainer.py.

🟢 pytorch_lightning: Docs
Check ID Status
make-doctest (pytorch) success
make-html (pytorch) success

These checks are required after the changes to src/pytorch_lightning/callbacks/model_checkpoint.py, src/pytorch_lightning/loggers/csv_logs.py, src/pytorch_lightning/trainer/trainer.py.

🟢 mypy
Check ID Status
mypy success

These checks are required after the changes to src/pytorch_lightning/callbacks/model_checkpoint.py, src/pytorch_lightning/loggers/csv_logs.py, src/pytorch_lightning/trainer/trainer.py.

🟢 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, fabric, 3.7) success
install-pkg (ubuntu-22.04, fabric, 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 (ubuntu-22.04, notset, 3.7) success
install-pkg (ubuntu-22.04, notset, 3.10) success
install-pkg (macOS-12, app, 3.7) success
install-pkg (macOS-12, app, 3.10) success
install-pkg (macOS-12, fabric, 3.7) success
install-pkg (macOS-12, fabric, 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 (macOS-12, notset, 3.7) success
install-pkg (macOS-12, notset, 3.10) success
install-pkg (windows-2022, app, 3.7) success
install-pkg (windows-2022, app, 3.10) success
install-pkg (windows-2022, fabric, 3.7) success
install-pkg (windows-2022, fabric, 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
install-pkg (windows-2022, notset, 3.7) success
install-pkg (windows-2022, notset, 3.10) success

These checks are required after the changes to src/pytorch_lightning/callbacks/model_checkpoint.py, src/pytorch_lightning/loggers/csv_logs.py, src/pytorch_lightning/trainer/trainer.py.


Thank you for your contribution! 💜

Note
This comment is automatically generated and updates for 60 minutes every 180 seconds. If you have any other questions, contact carmocca for help.

Copy link
Collaborator

@lantiga lantiga left a comment

Choose a reason for hiding this comment

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

Great catch @Borda!

@Borda Borda requested a review from justusschock as a code owner January 17, 2023 13:42
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.

LGTM. I'd like to get @awaelchli's stamp too though

@mergify mergify bot added the ready PRs ready to be merged label Jan 17, 2023
@carmocca carmocca disabled auto-merge January 17, 2023 14:13
@Borda Borda changed the title fix dirpath in log_dir fix dirpath in log_dir for CSVLogger Jan 17, 2023
@Borda Borda enabled auto-merge (squash) January 17, 2023 14:36
Copy link
Contributor

@awaelchli awaelchli left a comment

Choose a reason for hiding this comment

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

I don't understand why you get an attribute error. The attribute/property exists on the base logger and returns None by default. So this shouldn't happen at all.

Note: Underlying inconsistency will get fixed with #14188, but I haven't had the time to complete the work.

else:
dirpath = self.loggers[0].log_dir
logger_ = self.loggers[0]
dirpath = getattr(logger_, "log_dir", getattr(logger_, "save_dir", None))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why has log_dir precedence over save_dir? It should be the other way around to be consistent with the way it was before.

Copy link
Member Author

@Borda Borda Jan 17, 2023

Choose a reason for hiding this comment

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

👍 sorry for the confusion :)

Copy link
Contributor

Choose a reason for hiding this comment

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

What I'm saying is: dirpath = getattr(logger_, "save_dir", getattr(logger_, "log_dir", None))
(the order in which we access save_dir and log_dir)

because that's how it's done in the if-else above.

@Borda
Copy link
Member Author

Borda commented Jan 17, 2023

Underlying inconsistency will get fixed with #14188, but I haven't had the time to complete the work.

this would be great! it comes from creating legacy checkpoints which have not been part of normal CI so adding it here too 🦦

@Borda Borda merged commit d46091c into master Jan 17, 2023
@Borda Borda deleted the fix/legacy branch January 17, 2023 16:31
carmocca added a commit that referenced this pull request Jan 17, 2023
Borda added a commit that referenced this pull request Jan 17, 2023
@Borda Borda added this to the v1.9.x milestone Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working logger Related to the Loggers pl Generic label for PyTorch Lightning package priority: 1 Medium priority task ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants