Lovelive_Nijigasaki_VITS / ONNXVITS_utils.py
Mahiruoshi's picture
Upload 70 files
a36f6e8
raw
history blame
638 Bytes
import torch
import numpy as np
import random
import onnxruntime as ort
def set_random_seed(seed=0):
ort.set_seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.backends.cudnn.deterministic = True
random.seed(seed)
np.random.seed(seed)
def runonnx(model_path, **kwargs):
#如使用onnx-gpu,则providers三选一
#ort_session = ort.InferenceSession(model_path, providers=['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider'])
ort_session = ort.InferenceSession(model_path)
outputs = ort_session.run(
None,
kwargs
)
return outputs