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

Progress bar visuals enhancement #2162

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions nncf/common/logging/track_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
from rich.style import StyleType
from rich.text import Text

INTEL_BLUE_COLOR = "#0068b5"


class IterationsColumn(ProgressColumn):
def render(self, task: Task) -> Text:
if task.total is None:
return Text("")
text = f"{int(task.completed)}/{int(task.total)}"
if task.finished:
return Text(text, style="progress.elapsed")
return Text(text, style="progress.remaining")
return Text(text, style=INTEL_BLUE_COLOR)


class SeparatorColumn(ProgressColumn):
Expand All @@ -47,6 +47,18 @@ def render(self, task: Task) -> Text:
return Text("•")


class TimeElapsedColumnWithStyle(TimeElapsedColumn):
def render(self, task: "Task") -> Text:
text = super().render(task)
return Text(text._text[0], style=INTEL_BLUE_COLOR) # pylint: disable=protected-access


class TimeRemainingColumnWithStyle(TimeRemainingColumn):
def render(self, task: "Task") -> Text:
text = super().render(task)
return Text(text._text[0], style=INTEL_BLUE_COLOR) # pylint: disable=protected-access


class track:
def __init__(
self,
Expand Down Expand Up @@ -105,13 +117,14 @@ def __init__(
complete_style=complete_style,
finished_style=finished_style,
pulse_style=pulse_style,
bar_width=None,
),
TaskProgressColumn(show_speed=show_speed),
AlexanderDokuchaev marked this conversation as resolved.
Show resolved Hide resolved
IterationsColumn(),
SeparatorColumn(),
TimeElapsedColumn(),
TimeElapsedColumnWithStyle(),
SeparatorColumn(disable_if_no_total=True), # disable because time remaining will be empty
TimeRemainingColumn(),
TimeRemainingColumnWithStyle(),
)
)

Expand Down