voice-changer/server/voice_changer/RVC/inferencer/Inferencer.py
2023-05-29 17:34:35 +09:00

43 lines
1.1 KiB
Python

from typing import Any, Protocol
import torch
import onnxruntime
class Inferencer(Protocol):
# inferencerType: EnumInferenceTypes = EnumInferenceTypes.pyTorchRVC
# file: str
# isHalf: bool = True
# dev: device | None
# onnxProviders: list[str] | None
# onnxProviderOptions: Any | None
model: onnxruntime.InferenceSession | Any | None = None
def loadModel(self, file: str, gpu: int):
...
def infer(
self,
feats: torch.Tensor,
pitch_length: torch.Tensor,
pitch: torch.Tensor | None,
pitchf: torch.Tensor | None,
sid: torch.Tensor,
) -> torch.Tensor:
...
# def setProps(
# self,
# inferencerType: EnumInferenceTypes,
# file: str,
# dev: device | None,
# onnxProviders: list[str] | None,
# onnxProviderOptions: Any | None,
# isHalf: bool = True,
# ):
# self.inferencerType = inferencerType
# self.file = file
# self.isHalf = isHalf
# self.dev = dev
# self.onnxProviders = onnxProviders
# self.onnxProviderOptions = onnxProviderOptions