Hello,
I’m trying to plot real time loss curves as my model runs.  The model runs but does not print out the loss.  Could someone take a gander at the code below and see what mistake I’m making?
def Average(lst): 
    return sum(lst) / len(lst) 

epochs = 50
aggregated_losses = []

max_trn_batch =  4

for i in range(epochs):
    epoch_loss = []
    for b, (image, label, policy, categorical_data) in enumerate(train_loader): #, numerical_data
        image = image.cuda()
        label = label.cuda()
        #numerical_data = numerical_data.cuda()
        categorical_data = categorical_data.cuda()
        
        #count batches
        b += 1
        
        #throttle teh batches
        if b == max_trn_batch:
            break
        
        y_pred = combined_model(image, categorical_data) #, numerical_data
        single_loss = criterion(y_pred, label)
        
        # statistics
        print(f'epoch: {i:3}, batch: {b:3}, loss: {single_loss.item():10.8f}')

        optimizer.zero_grad()
        single_loss.backward()
        optimizer.step()
        epoch_loss.append(single_loss.cpu().data.numpy())
    
    print(Average(epoch_loss))
    aggregated_losses.append(Average(epoch_loss))
    loss_history = pd.DataFrame(aggregated_losses).reset_index()
    loss_history.rename(columns = {'index':'epoch', 0:'average_epoch_loss'},inplace = True)
    x = sns.lineplot(x = 'epoch', y = 'average_epoch_loss', data = loss_history)
    
    
    scheduler.step(Average(epoch_loss))