Update models.py

This commit is contained in:
RVC-Boss 2023-08-14 11:06:17 +08:00 committed by GitHub
parent 2bda203378
commit 4b028e6266
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -414,13 +414,19 @@ class SourceModuleHnNSF(torch.nn.Module):
self.l_tanh = torch.nn.Tanh()
def forward(self, x, upp=None):
if hasattr(self,"ddtype")==False:
self.ddtype=self.l_linear.weight.dtype
sine_wavs, uv, _ = self.l_sin_gen(x, upp)
if self.is_half:
sine_wavs = sine_wavs.half()
sine_merge = self.l_tanh(self.l_linear(sine_wavs.to(x)))
# print(x.dtype,sine_wavs.dtype,self.l_linear.weight.dtype)
# if self.is_half:
# sine_wavs = sine_wavs.half()
# sine_merge = self.l_tanh(self.l_linear(sine_wavs.to(x)))
# print(sine_wavs.dtype,self.ddtype)
if(sine_wavs.dtype!=self.ddtype):
sine_wavs=sine_wavs.to(self.ddtype)
sine_merge = self.l_tanh(self.l_linear(sine_wavs))
return sine_merge, None, None # noise, uv
class GeneratorNSF(torch.nn.Module):
def __init__(
self,