-
Notifications
You must be signed in to change notification settings - Fork 1.6k
add coloring in tqdm progress bar #1573
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
Conversation
|
One item worth consideration: by overriding the default color we may make the bar less visible on some systems. E.g. someone who uses a light-green terminal may have a hard time seeing a green progress bar. I don't think there's a combination of colors that will work on every system, so perhaps the solution could be to allow turning this behavior off somehow. |
anautsch
left a comment
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.
@sangeet2020 thanks for making this a smaller PR !
(and sorry for the delay on our side)
@mravanelli was asking internally if we could have the SB color of the new logo.
The tqdm allows for color codes to be passed too. With a color picker on the SB logo svg file, I got two color values 328ce7 (and a darker 4c99e8).
As @pplantinga mentioned - customization is key here - the run opts could be useful here.
How about having an option between setting three different colors -or- overriding all of them with one argument? (having both options available, is it feasible?)
|
@sangeet2020, could you please do the modifications suggested by @anautsch? |
|
Hi, I agree with all the suggestions @pplantinga and @anautsch mentioned. It's better to have an override that can suppress the colored progress bar and rather use the default color- white. Here is the override "--white_tqdm",
default=False,
action="store_true",
help="Enable default (white) color for tqdm progress-bar. If this is "
"not passed a multi-colored progress-bar is used.",and within "white_tqdm": False,
"tqdm_progressbar": {
"train": "GREEN",
"valid": "MAGENTA",
"test": "CYAN",
},so whenever, # Force default color for tqdm progrressbar
if self.white_tqdm:
self.tqdm_progressbar = dict.fromkeys(self.tqdm_progressbar, "")Let me know if this is an acceptable optimal solution. If you guys are okay with this, I shall further change the currently hard-coded colors to use the colors present in SpeechBrain's logo as mentioned by @anautsch ( |
|
Hi @anautsch, is there any update on this one? Do you recommend any other color combination? |
anautsch
left a comment
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.
Hi @sangeet2020 thank you for pushing this again.
I like the idea, don't worry. For me, this is not about discussing colors. Wondering if we can figure a terminal color out to use then a matching color scheme. (Way beyond the scope of this PR.)
The default setting should be as it is now for everyone, in a way—but: when we have a new release, switching that to a SB color would also be a good touch-up. (thinking out loud)
In a way, it is funny "not discussing colors" but then also "default: white".
When people use another terminal color scheme, we have no way to control what is light/dark in terms of colors we put forth. Then, whatever their default is, it will be white or another color, as to their default preference. (please rename the variable -> not all defaults are white; maybe it's just me but I start having absurd discussions with myself here)
I spotted this PR on some dark mode issues:
https://github.com/tqdm/tqdm/issues/842
we will not be able to control all environments, in which people will use SpeechBrain (terminal, server console, some editor, colab, jupyter, ...) neither the type of shell (bash, fish, zsh, ...) nor their (non-linux) OS. This just makes me think, when I use dark mode while browsing, some websites are not able to handle it well at all.
In a way, having nice colors matching to the terminal settings must be a tqdm concern with a good amount of discussion done already. Is there more to it?
I don't know what an optimal solution is here, can only talk it through to understand it better.
Came across this one too
https://github.com/MicrosoftDocs/terminal/blob/main/TerminalDocs/customize-settings/color-schemes.md
should or can we set the tqdm background as well, if needed?
Please let me know if these questions help you or appear bogus - there's no need to make this PR bigger than it needs to be.
|
Thanks for your detailed thoughts.
In my opinion, we should make it simple- use the default colored progress bar, or use a multi-colored progress bar and if that's a problem- switch back to the default setting and let tqdm handle what color to use in particular that environment setting. |
Sounds good! I ran a test with and the color did not change—when I took Do you have a minimal example that I could use to verify it works? When I commented above, I thought it would be possible to provide a |
|
Hi, Basically, not passing any arguments would enable default setting for tqdm progress bar. While if Let me know if you find this suitable or you wish some changes. Thank You |
anautsch
left a comment
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.
works!
THANK YOU :)
business as usual
python recipes/LibriSpeech/ASR/seq2seq/train.py recipes/LibriSpeech/ASR/seq2seq/hparams/train_BPE_1000.yaml --data_folder=tests/samples/ASR/ --train_csv=tests/samples/annotation/ASR_train.csv --valid_csv=tests/samples/annotation/ASR_train.csv --test_csv=[tests/samples/annotation/ASR_train.csv] --number_of_epochs=1 --skip_prep=True --data_folder_rirs=tests/tmp --device="cpu" --debug
colored progress bars as suggested—there's a clear visual difference between speechbrain.STAGES (!) with --tqdm_colored_bar (as you described)
python recipes/LibriSpeech/ASR/seq2seq/train.py recipes/LibriSpeech/ASR/seq2seq/hparams/train_BPE_1000.yaml --data_folder=tests/samples/ASR/ --train_csv=tests/samples/annotation/ASR_train.csv --valid_csv=tests/samples/annotation/ASR_train.csv --test_csv=[tests/samples/annotation/ASR_train.csv] --number_of_epochs=1 --skip_prep=True --data_folder_rirs=tests/tmp --device="cpu" --debug --tqdm_colored_bar
one can override cli params for different colours by --tqdm_barcolor={"train": "BLUE", "valid": "RED", "test": "YELLOW"}
python recipes/LibriSpeech/ASR/seq2seq/train.py recipes/LibriSpeech/ASR/seq2seq/hparams/train_BPE_1000.yaml --data_folder=tests/samples/ASR/ --train_csv=tests/samples/annotation/ASR_train.csv --valid_csv=tests/samples/annotation/ASR_train.csv --test_csv=[tests/samples/annotation/ASR_train.csv] --number_of_epochs=1 --skip_prep=True --data_folder_rirs=tests/tmp --device="cpu" --debug --tqdm_colored_bar --tqdm_barcolor={"train": "BLUE", "valid": "RED", "test": "YELLOW"}
or put custom colors into hparams
tqdm_barcolor:
train: BLUE
valid: "#328ce7"
test: "#4c99e8"=> regarding SpeechBrain colour discussion: they all look "BLUE" to me.
I played a bit with https://colorbrewer2.org/ to compare different colour schemes - the current one put forth by @sangeet2020 is close to colorblind safe schemes and as tqdm default colour names are used, I've a good feeling regarding accessibility! We can update later if necessary.
LGTM!
|
Looks good to me. Thank You SB Team. |


I initiate a PR to change the color of tqdm progress bar during training, validation and test.
The main aim is to visually distinguish between train, valid and test during the script run phase.