WIP: support rvc v2

This commit is contained in:
wataru 2023-05-21 11:50:28 +09:00
parent 25bb1ee078
commit 1405a276a9
6 changed files with 48 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,18 @@ export const ModelSwitchRow = (_props: ModelSwitchRowProps) => {
const f0str = x.f0 == true ? "f0" : "nof0"
const srstr = Math.floor(x.samplingRate / 1000) + "K"
const embedstr = x.embChannels
const typestr = x.modelType == 0 ? "org" : "webui"
const typestr = (() => {
if (x.modelType == "pyTorchRVC" || x.modelType == "pyTorchRVCNono") {
return "org"
} else if (x.modelType == "pyTorchRVCv2" || x.modelType == "pyTorchRVCv2Nono") {
return "orv_v2"
} else if (x.modelType == "pyTorchWebUI" || x.modelType == "pyTorchWebUINono") {
return "webui"
} else {
return "unknown"
}
})()
const metadata = x.deprecated ? `[${index}] [deprecated version]` : `[${index}] [${f0str},${srstr},${embedstr},${typestr}]`
const tuning = `t:${x.defaultTune}`
const useIndex = x.indexFile != null && x.featureFile != null ? `i:true` : `i:false`

View File

@ -83,6 +83,9 @@ export const MergeLabRow = (_props: MergeLabRowProps) => {
srcSample.modelType != tgtSample.modelType
) {
alert("current selected model is not same as the other selected.")
console.log("current selected model is not same as the other selected.", srcSample.samplingRate, tgtSample.samplingRate,
srcSample.embChannels, tgtSample.embChannels,
srcSample.modelType, tgtSample.modelType)
return
}
@ -114,7 +117,18 @@ export const MergeLabRow = (_props: MergeLabRowProps) => {
const f0str = modelInfo.f0 == true ? "f0" : "nof0"
const srstr = Math.floor(modelInfo.samplingRate / 1000) + "K"
const embedstr = modelInfo.embChannels
const typestr = modelInfo.modelType == 0 ? "org" : "webui"
const typestr = (() => {
if (modelInfo.modelType == "pyTorchRVC" || modelInfo.modelType == "pyTorchRVCNono") {
return "org"
} else if (modelInfo.modelType == "pyTorchRVCv2" || modelInfo.modelType == "pyTorchRVCv2Nono") {
return "orv_v2"
} else if (modelInfo.modelType == "pyTorchWebUI" || modelInfo.modelType == "pyTorchWebUINono") {
return "webui"
} else {
return "unknown"
}
})()
const metadata = `[${f0str},${srstr},${embedstr},${typestr}]`

View File

@ -70,6 +70,17 @@ export const DiffMethod = {
} as const
export type DiffMethod = typeof DiffMethod[keyof typeof DiffMethod]
export const ModelType = {
"pyTorchRVC": "pyTorchRVC",
"pyTorchRVCNono": "pyTorchRVCNono",
"pyTorchRVCv2": "pyTorchRVCv2",
"pyTorchRVCv2Nono": "pyTorchRVCv2Nono",
"pyTorchWebUI": "pyTorchWebUI",
"pyTorchWebUINono": "pyTorchWebUINono",
"onnxRVC": "onnxRVC",
"onnxRVCNono": "onnxRVCNono",
} as const
export type ModelType = typeof ModelType[keyof typeof ModelType]
export const ServerSettingKey = {
"srcId": "srcId",
@ -188,7 +199,7 @@ type ModelSlot = {
defaultTune: number,
defaultIndexRatio: number,
modelType: number,
modelType: ModelType,
embChannels: number,
f0: boolean,
samplingRate: number

View File

@ -57,7 +57,8 @@ def _setInfoByPytorch(slot: ModelSlot):
if config_len == 18:
slot.f0 = True if cpt["f0"] == 1 else False
version = cpt.get("version", "v1")
if version == "v1":
print("version..............", version)
if version is None or version == "v1":
slot.modelType = (
EnumInferenceTypes.pyTorchRVC
if slot.f0
@ -74,6 +75,7 @@ def _setInfoByPytorch(slot: ModelSlot):
slot.embChannels = 768
slot.embedder = EnumEmbedderTypes.hubert
print("model slot ORG", slot)
else:
slot.f0 = True if cpt["f0"] == 1 else False
slot.modelType = (
@ -95,6 +97,8 @@ def _setInfoByPytorch(slot: ModelSlot):
else:
raise RuntimeError("[Voice Changer][setInfoByONNX] unknown embedder")
print("model slot DADAPAN", slot)
slot.samplingRate = cpt["config"][-1]
del cpt

View File

@ -57,6 +57,7 @@ def merge_model(request: MergeModelRequest):
merged["config"] = state_dict["config"]
merged["params"] = state_dict["params"] if "params" in state_dict else None
merged["version"] = state_dict["version"] if "version" in state_dict else None
merged["sr"] = state_dict["sr"]
merged["f0"] = state_dict["f0"]
merged["info"] = state_dict["info"]