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

Don't overwrite existing excepthook in mlflow logger #3672

Closed
wants to merge 7 commits into from

Conversation

dakinggg
Copy link
Contributor

@dakinggg dakinggg commented Oct 21, 2024

What does this PR do?

The previous PR that added exception hook handling to mlflow just blindly overwrites the existing excepthook. This PR changes that to use the existing excepthook and just add what the mlflow logger needs.

Before: llama-7b-commits-6-D3ipHw (exception is not rich formatted, because systemwide excepthook is not triggered)
After: llama-7b-commits-11-3KdS8L (exception is rich formatted, because systemwide excepthook is triggered)

@dakinggg dakinggg requested a review from a team as a code owner October 21, 2024 23:09
Copy link
Contributor

@siriuslee siriuslee left a comment

Choose a reason for hiding this comment

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

🎉

@dakinggg dakinggg requested a review from mvpatel2000 October 21, 2024 23:19
Copy link
Contributor

@irenedea irenedea left a comment

Choose a reason for hiding this comment

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

LGTM, good catch!

@@ -322,7 +322,13 @@ def init(self, state: State, logger: Logger) -> None:
self.run_name += f'-rank{dist.get_global_rank()}'

# Register the global exception handler so that uncaught exception is tracked.
sys.excepthook = self._global_exception_handler
original_excepthook = sys.excepthook
Copy link
Contributor

Choose a reason for hiding this comment

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

alternatively you could save original_excepthook on self (i.e. self.original_excepthook), so you don't need to use a lambda below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah i think lambda is ok. could've also done functools.partial. don't feel particularly strongly between any of those options

Copy link
Contributor

@mvpatel2000 mvpatel2000 left a comment

Choose a reason for hiding this comment

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

LGTM, good catch

@dakinggg
Copy link
Contributor Author

Closing in favor of #3675

@dakinggg dakinggg closed this Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants