tqdm notebook - 2 inner bars
I'm trying to print training progress bar using tqdm.
I'd like to track the progress of the epochs, and for each epoch i have 2 progress bars: the train_loader minibatches, and validation_loader minibatches.
The code is something like that:
for epoch in tqdm(range(epochs_num)):
    for inputs, labels in tqdm(train_loader, &quot;Train progress&quot;, leave=False):
        # train...
    with torch.no_grad():
        for inputs, labels in tqdm(validation_loader, &quot;Validation progress&quot;, leave=False):
            # calc validation loss

Using the leave argument, the progress bars deleted every epoch, but I'd like to delete them togather, right after the validation process ends.
There's any way to do it?
Thanks

You can reuse your progress bars and do the updates manually like this:
epochs = tqdm(range(epochs_num), desc=&quot;Epochs&quot;)
training_progress = tqdm(total=training_batch_size, desc=&quot;Training progress&quot;)
validation_progress = tqdm(total=validation_batch_size, desc=&quot;Validation progress&quot;)

for epoch in epochs:
    training_progress.reset()
    validation_progress.reset()
    
    for inputs, labels in train_loader:
        # train...
        training_progress.update()
        
    with torch.no_grad():
        for inputs, labels in validation_loader:
            # calc validation loss
            validation_progress.update()

If the batch sizes are not always the same, you can calculate them on the fly and call reset(total=new_size).
