mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-01-24 14:05:00 +03:00
30 lines
924 B
Python
30 lines
924 B
Python
|
from const import DiffusionSVCInferenceType
|
||
|
from voice_changer.DiffusionSVC.inferencer.DiffusionSVCInferencer import DiffusionSVCInferencer
|
||
|
from voice_changer.RVC.inferencer.Inferencer import Inferencer
|
||
|
|
||
|
|
||
|
class InferencerManager:
|
||
|
currentInferencer: Inferencer | None = None
|
||
|
|
||
|
@classmethod
|
||
|
def getInferencer(
|
||
|
cls,
|
||
|
inferencerType: DiffusionSVCInferenceType,
|
||
|
file: str,
|
||
|
gpu: int,
|
||
|
) -> Inferencer:
|
||
|
cls.currentInferencer = cls.loadInferencer(inferencerType, file, gpu)
|
||
|
return cls.currentInferencer
|
||
|
|
||
|
@classmethod
|
||
|
def loadInferencer(
|
||
|
cls,
|
||
|
inferencerType: DiffusionSVCInferenceType,
|
||
|
file: str,
|
||
|
gpu: int,
|
||
|
) -> Inferencer:
|
||
|
if inferencerType == "combo":
|
||
|
return DiffusionSVCInferencer().loadModel(file, gpu)
|
||
|
else:
|
||
|
raise RuntimeError("[Voice Changer] Inferencer not found", inferencerType)
|