Add files via upload

This commit is contained in:
RVC-Boss
2023-05-13 03:29:30 +08:00
committed by GitHub
parent 0bc1ea782e
commit 44449efc2e
4 changed files with 162 additions and 63 deletions

View File

@@ -18,6 +18,10 @@ from fairseq import checkpoint_utils
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
if torch.cuda.is_available():device="cuda"
elif torch.backends.mps.is_available():device="mps"
else:device="cpu"
f = open("%s/extract_f0_feature.log" % exp_dir, "a+")
@@ -60,7 +64,7 @@ models, saved_cfg, task = checkpoint_utils.load_model_ensemble_and_task(
model = models[0]
model = model.to(device)
printt("move model to %s" % device)
if device != "cpu":
if device not in ["mps","cpu"]:
model = model.half()
model.eval()
@@ -83,7 +87,7 @@ else:
padding_mask = torch.BoolTensor(feats.shape).fill_(False)
inputs = {
"source": feats.half().to(device)
if device != "cpu"
if device not in ["mps", "cpu"]
else feats.to(device),
"padding_mask": padding_mask.to(device),
"output_layer": 9, # layer 9