[BUG] rich.prograss.track() Prograss Bar without color
See original GitHub issueDescribe the bug I want use rich colorful terminal progress bar to monitor training processing by PyTorch module. You can see the code here
for i, (image, mask) in track(enumerate(train_loader), description=f"train_{epoch}", total=len(train_loader)):
image, mask = image.to(device), mask.to(device)
predict_image = net(image)
train_loss = loss_function(predict_image, mask)
loss_list = np.append(loss_list, train_loss.item())
opt.zero_grad()
train_loss.backward()
opt.step()
train_preds = torch.cat((train_preds, predict_image.cpu().detach()), 0)
train_truths = torch.cat((train_truths, mask.cpu().detach()), 0)
_image = image[0]
_mask = mask[0]
_pred_image = predict_image[0]
_pred_image[_pred_image >= threshold] = 1
_pred_image[_pred_image < threshold] = 0
vaisual_image = torch.stack([_image, _mask, _pred_image], dim=0)
torchvision.utils.save_image(vaisual_image, os.path.join(monitor_path, 'train', f'{i}.png'))
But the bar is without color and in a high flicker.
Platform
Win and Powershell
β β β color_system = βtruecolorβ β β encoding = βutf-8β β β file = <_io.TextIOWrapper name=β<stdout>β mode=βwβ encoding=βutf-8β> β β height = 30 β β is_alt_screen = False β β is_dumb_terminal = False β β is_interactive = True β β is_jupyter = False β β is_terminal = True β β legacy_windows = False β β no_color = False β β options = ConsoleOptions( β β size=ConsoleDimensions(width=120, height=30), β β legacy_windows=False, β β min_width=1, β β max_width=120, β β is_terminal=True, β β encoding=βutf-8β, β β max_height=30, β β justify=None, β β overflow=None, β β no_wrap=False, β β highlight=None, β β markup=None, β β height=None β β ) β β quiet = False β β record = False β β safe_box = True β β size = ConsoleDimensions(width=120, height=30) β β soft_wrap = False β β stderr = False β β style = None β β tab_size = 8 β β width = 120
Issue Analytics
- State:
- Created a year ago
- Comments:17 (7 by maintainers)
I think this comment solves this issue. The result is good on VSCode (or -insider). But on the windows console, as the same as before, and NO improvement has been achieved.
Same problem here, I checked out with
rich.progress.track()
and in another example, I used the βLiveβ progress bar like your example in here, It works perfectly. BUT when I combine it with Pytorch, It goes wrong.Here is some screenshot: Good (This should look like):
Bad (What I got):
I Couldnβt figure out why, Please help.