-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Improvements for rich progress bar #9559
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Sean!
Co-authored-by: Adrian Wälchli <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #9559 +/- ##
=======================================
- Coverage 93% 89% -4%
=======================================
Files 180 180
Lines 15110 15117 +7
=======================================
- Hits 14036 13429 -607
- Misses 1074 1688 +614 |
STYLES: Dict[str, str] = { | ||
"train": "red", | ||
"sanity_check": "yellow", | ||
"validate": "yellow", | ||
"test": "yellow", | ||
"predict": "yellow", | ||
} | ||
@dataclass | ||
class RichProgressBarTheme: | ||
"""Styles to associate to different base components. | ||
|
||
https://rich.readthedocs.io/en/stable/style.html | ||
""" | ||
|
||
text_color: str = "white" | ||
progress_bar_complete: Union[str, Style] = "#6206E0" | ||
progress_bar_finished: Union[str, Style] = "#6206E0" | ||
batch_process: str = "white" | ||
time: str = "grey54" | ||
processing_speed: str = "grey70" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noob question: Why did we introduce this new class RichProgressBarTheme
and pass an instance to RichProgressBar
? I'm asking because if we didn't have this class and passed colours (or a dictionary of colours) directly to RichProgressBar
, colour customisation would be easier for users in my opinion. (One less thing to remember :])
from pytorch_lightning.callbacks import RichProgressBar
-from pytorch_lightning.callbacks.progress.rich_progress import RichProgressBarTheme
progress_bar = RichProgressBar(
- theme=RichProgressBarTheme(
description="green_yellow",
progress_bar="green1",
progress_bar_finished="green1",
batch_progress="green_yellow",
time="grey82",
processing_speed="grey82",
metrics="grey82",
- )
)
FYI, I'm looking at the example in the blog post: https://devblog.pytorchlightning.ai/super-charged-progress-bars-with-rich-lightning-669653d6ab97
What does this PR do?
Fixes #9547
Introduces a theme dataclass to control the styles, fix keyboard interrupts and sets defaults to style like the linked issue.
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃