Update models.py (#1116)

This commit is contained in:
XXXXRT666 2024-05-27 04:12:51 +01:00 committed by GitHub
parent 90e92b079e
commit 151184598a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -907,7 +907,7 @@ class SynthesizerTrn(nn.Module):
ge = self.ref_enc(y * y_mask, y_mask)
with autocast(enabled=False):
maybe_no_grad = torch.no_grad() if self.freeze_quantizer else contextlib.nullcontext
maybe_no_grad = torch.no_grad() if self.freeze_quantizer else contextlib.nullcontext()
with maybe_no_grad:
if self.freeze_quantizer:
self.ssl_proj.eval()