mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2025-04-26 22:48:59 +08:00
Support mps generate (#263)
This commit is contained in:
parent
5b0ff12163
commit
6cc2279fb9
@ -86,6 +86,7 @@ class Config:
|
|||||||
elif torch.backends.mps.is_available():
|
elif torch.backends.mps.is_available():
|
||||||
print("没有发现支持的N卡, 使用MPS进行推理")
|
print("没有发现支持的N卡, 使用MPS进行推理")
|
||||||
self.device = "mps"
|
self.device = "mps"
|
||||||
|
self.is_half = False
|
||||||
else:
|
else:
|
||||||
print("没有发现支持的N卡, 使用CPU进行推理")
|
print("没有发现支持的N卡, 使用CPU进行推理")
|
||||||
self.device = "cpu"
|
self.device = "cpu"
|
||||||
|
@ -246,6 +246,8 @@ class VC(object):
|
|||||||
pitch, pitchf = self.get_f0(audio_pad, p_len, f0_up_key, f0_method, inp_f0)
|
pitch, pitchf = self.get_f0(audio_pad, p_len, f0_up_key, f0_method, inp_f0)
|
||||||
pitch = pitch[:p_len]
|
pitch = pitch[:p_len]
|
||||||
pitchf = pitchf[:p_len]
|
pitchf = pitchf[:p_len]
|
||||||
|
if self.device == "mps":
|
||||||
|
pitchf = pitchf.astype(np.float32)
|
||||||
pitch = torch.tensor(pitch, device=self.device).unsqueeze(0).long()
|
pitch = torch.tensor(pitch, device=self.device).unsqueeze(0).long()
|
||||||
pitchf = torch.tensor(pitchf, device=self.device).unsqueeze(0).float()
|
pitchf = torch.tensor(pitchf, device=self.device).unsqueeze(0).float()
|
||||||
t2 = ttime()
|
t2 = ttime()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user