Progress bar reprints during validation

Hi!

My progress bar updates in place nicely during training steps, but then during validation something weird happens and it starts printing out each step line-by-line:
image

The train/val step code is pretty minimal:

def training_step(self, batch, batch_idx):
    img, target = batch
    heatmap = self(img)

    loss = (1 - F.cosine_similarity(target, heatmap)).mean()
    self.log('train_loss', loss)

    return {'loss': loss}

def validation_step(self, batch, batch_idx):
    img, target = batch
    heatmap = self(img)

    loss = (1 - F.cosine_similarity(target, heatmap)).mean()
    self.log('val_loss', loss)

    return {'val_loss': loss}

Would be grateful if someone pointed out what I’m doing wrong, thanks!

In my experience tqdm (the library used to generate these progress bars) can sometimes glitch like this. I have found that resizing your terminal and/or redrawing (if your terminal supports it) can correct the issue.

Ah, right. Seems to only be glitching in the PyCharm console for me. A bit annoying, but not critical. Thanks!