mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-02-03 00:33:57 +03:00
bugfix: halfprecision
This commit is contained in:
parent
dc7f9a0e15
commit
26a59857b3
@ -165,11 +165,10 @@ class Pipeline(object):
|
|||||||
weight /= weight.sum(axis=1, keepdims=True)
|
weight /= weight.sum(axis=1, keepdims=True)
|
||||||
npy = np.sum(self.big_npy[ix] * np.expand_dims(weight, axis=2), axis=1)
|
npy = np.sum(self.big_npy[ix] * np.expand_dims(weight, axis=2), axis=1)
|
||||||
|
|
||||||
if self.isHalf is True:
|
|
||||||
npy = npy.astype("float16")
|
|
||||||
|
|
||||||
# recover silient font
|
# recover silient font
|
||||||
npy = np.concatenate([np.zeros([npyOffset, npy.shape[1]]), npy])
|
npy = np.concatenate([np.zeros([npyOffset, npy.shape[1]]), npy])
|
||||||
|
if self.isHalf is True:
|
||||||
|
npy = npy.astype("float16")
|
||||||
|
|
||||||
feats = (
|
feats = (
|
||||||
torch.from_numpy(npy).unsqueeze(0).to(self.device) * index_rate
|
torch.from_numpy(npy).unsqueeze(0).to(self.device) * index_rate
|
||||||
@ -225,6 +224,7 @@ class Pipeline(object):
|
|||||||
).data.to(dtype=torch.int16)
|
).data.to(dtype=torch.int16)
|
||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
if "HALF" in e.__str__().upper():
|
if "HALF" in e.__str__().upper():
|
||||||
|
print("11", e)
|
||||||
raise HalfPrecisionChangingException()
|
raise HalfPrecisionChangingException()
|
||||||
else:
|
else:
|
||||||
raise e
|
raise e
|
||||||
|
Loading…
Reference in New Issue
Block a user