From b59f4af5d8b4b7f3b0b70e6fbb9d27ad87502ea5 Mon Sep 17 00:00:00 2001 From: AznamirWoW <101997116+AznamirWoW@users.noreply.github.com> Date: Fri, 3 Jan 2025 18:55:39 -0500 Subject: [PATCH] fixing memory leak ~7MB/s during training --- rvc/train/train.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rvc/train/train.py b/rvc/train/train.py index 7a748b2d..a407a1f1 100644 --- a/rvc/train/train.py +++ b/rvc/train/train.py @@ -654,7 +654,7 @@ def train_and_evaluate( # loss_disc, _, _ = discriminator_loss_scaled(y_d_hat_r, y_d_hat_g) loss_disc, _, _ = discriminator_loss(y_d_hat_r, y_d_hat_g) # Discriminator backward and update - epoch_disc_sum += loss_disc + epoch_disc_sum += loss_disc.item() optim_d.zero_grad() scaler.scale(loss_disc).backward() scaler.unscale_(optim_d) @@ -689,7 +689,7 @@ def train_and_evaluate( "value": loss_gen_all, "epoch": epoch, } - epoch_gen_sum += loss_gen_all + epoch_gen_sum += loss_gen_all.item() optim_g.zero_grad() scaler.scale(loss_gen_all).backward() scaler.unscale_(optim_g)