Skip to content

Commit

Permalink
allow for a custom reconstruction target in soundstream
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Apr 28, 2023
1 parent c3fabc3 commit d05c020
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion audiolm_pytorch/soundstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ def seq_len_multiple_of(self):
def forward(
self,
x,
target = None,
return_encoded = False,
return_discr_loss = False,
return_discr_losses_separately = False,
Expand Down Expand Up @@ -752,7 +753,9 @@ def forward(

# recon loss

recon_loss = F.mse_loss(orig_x, recon_x)
target = default(target, orig_x) # target can also be passed in, in the case of denoising

recon_loss = F.mse_loss(target, recon_x)

# multispectral recon loss - eq (4) and (5) in https://arxiv.org/abs/2107.03312

Expand Down
2 changes: 1 addition & 1 deletion audiolm_pytorch/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.28.1'
__version__ = '0.28.2'

0 comments on commit d05c020

Please sign in to comment.