File size: 686 Bytes
3a010aa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from accelerate import Accelerator
from infer.lib.rmvpe import RMVPE
from fairseq.checkpoint_utils import load_model_ensemble_and_task

accelerator = Accelerator()
device = accelerator.device
print(f"Using device: {device}")

fp16 = accelerator.mixed_precision == "fp16"
print(f"Using fp16: {fp16}")

rmvpe_model_path = "assets/rmvpe/rmvpe.pt"
rmvpe = RMVPE(rmvpe_model_path, is_half=fp16, device=device)
print("RMVPE model loaded.")

hubert_model_path = "assets/hubert/hubert_base.pt"
models, hubert_cfg, _ = load_model_ensemble_and_task([hubert_model_path])
hubert = models[0]
hubert = hubert.to(device)
if fp16:
    hubert = hubert.half()
hubert.eval()
print("Hubert model loaded.")