fix: exclude GAFilter params from L2-SP regularization
L2-SP anchors trainable params to their pretrained values. GAFilter is a newly initialized module (identity FIR filter) with no pretrained values — anchoring it to identity initialization would resist learning. Exclude gafilter params from the L2-SP loss so they train freely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -812,7 +812,9 @@ def _do_train(vocoder, mel_converter, clips,
|
|||||||
l2sp_loss = torch.zeros(1, device=device)
|
l2sp_loss = torch.zeros(1, device=device)
|
||||||
if lambda_l2sp > 0.0 and ref_params:
|
if lambda_l2sp > 0.0 and ref_params:
|
||||||
for name, param in vocoder.named_parameters():
|
for name, param in vocoder.named_parameters():
|
||||||
if name in ref_params and param.requires_grad:
|
# Skip GAFilter — newly initialized, not pretrained; L2-SP
|
||||||
|
# anchoring to identity would fight against learning.
|
||||||
|
if name in ref_params and param.requires_grad and "gafilter" not in name:
|
||||||
l2sp_loss = l2sp_loss + F.mse_loss(
|
l2sp_loss = l2sp_loss + F.mse_loss(
|
||||||
param, ref_params[name], reduction="sum"
|
param, ref_params[name], reduction="sum"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user