mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-02-02 16:23:58 +03:00
WIP: support so-vits-svc 40v2. dstID list from server.
This commit is contained in:
parent
1f33cd547d
commit
39fab4afc1
2
client/demo_so-vits-svc_40v2/dist/index.js
vendored
2
client/demo_so-vits-svc_40v2/dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -57,6 +57,7 @@ export const useModelSettingArea = (): ServerSettingState => {
|
|||||||
file: file
|
file: file
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
const onConfigFileClearClicked = () => {
|
const onConfigFileClearClicked = () => {
|
||||||
appState.serverSetting.setFileUploadSetting({
|
appState.serverSetting.setFileUploadSetting({
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { ServerInfoSoVitsSVC } from "@dannadori/voice-changer-client-js";
|
||||||
import React, { useMemo, useState } from "react"
|
import React, { useMemo, useState } from "react"
|
||||||
import { useAppState } from "./001_provider/001_AppStateProvider";
|
import { useAppState } from "./001_provider/001_AppStateProvider";
|
||||||
import { AnimationTypes, HeaderButton, HeaderButtonProps } from "./components/101_HeaderButton";
|
import { AnimationTypes, HeaderButton, HeaderButtonProps } from "./components/101_HeaderButton";
|
||||||
@ -5,6 +6,7 @@ import { AnimationTypes, HeaderButton, HeaderButtonProps } from "./components/10
|
|||||||
export const useSpeakerSetting = () => {
|
export const useSpeakerSetting = () => {
|
||||||
const appState = useAppState()
|
const appState = useAppState()
|
||||||
|
|
||||||
|
|
||||||
const accodionButton = useMemo(() => {
|
const accodionButton = useMemo(() => {
|
||||||
const accodionButtonProps: HeaderButtonProps = {
|
const accodionButtonProps: HeaderButtonProps = {
|
||||||
stateControlCheckbox: appState.frontendManagerState.stateControls.openSpeakerSettingCheckbox,
|
stateControlCheckbox: appState.frontendManagerState.stateControls.openSpeakerSettingCheckbox,
|
||||||
@ -18,17 +20,26 @@ export const useSpeakerSetting = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const dstIdRow = useMemo(() => {
|
const dstIdRow = useMemo(() => {
|
||||||
|
const settings = appState.serverSetting.serverSetting as ServerInfoSoVitsSVC
|
||||||
|
const speakers = settings.speakers
|
||||||
|
if (!speakers) {
|
||||||
|
return <></>
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentValue = Object.values(speakers).includes(appState.serverSetting.serverSetting.dstId) ? appState.serverSetting.serverSetting.dstId : -1
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="body-row split-3-2-1-4 left-padding-1 guided">
|
<div className="body-row split-3-2-1-4 left-padding-1 guided">
|
||||||
<div className="body-item-title left-padding-1">Destination Speaker Id</div>
|
<div className="body-item-title left-padding-1">Destination Speaker Id</div>
|
||||||
<div className="body-select-container">
|
<div className="body-select-container">
|
||||||
<select className="body-select" value={appState.serverSetting.serverSetting.dstId} onChange={(e) => {
|
<select className="body-select" value={currentValue} onChange={(e) => {
|
||||||
appState.serverSetting.updateServerSettings({ ...appState.serverSetting.serverSetting, dstId: Number(e.target.value) })
|
appState.serverSetting.updateServerSettings({ ...appState.serverSetting.serverSetting, dstId: Number(e.target.value) })
|
||||||
|
|
||||||
}}>
|
}}>
|
||||||
|
<option key="unknown" value={-1}>unknwon(-1)</option>
|
||||||
{
|
{
|
||||||
[0, 1, 2, 3, 4].map(x => {
|
Object.keys(speakers).map(x => {
|
||||||
return <option key={x} value={x}>{x}</option>
|
return <option key={x} value={speakers[x]}>{x}({speakers[x]})</option>
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
|
@ -112,6 +112,9 @@ export type ServerInfo = VoiceChangerServerSetting & {
|
|||||||
onnxExecutionProviders: OnnxExecutionProvider[]
|
onnxExecutionProviders: OnnxExecutionProvider[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ServerInfoSoVitsSVC = ServerInfo & {
|
||||||
|
speakers: { [key: string]: number }
|
||||||
|
}
|
||||||
export const DefaultServerSetting_MMVCv15: ServerInfo = {
|
export const DefaultServerSetting_MMVCv15: ServerInfo = {
|
||||||
srcId: 0,
|
srcId: 0,
|
||||||
dstId: 101,
|
dstId: 101,
|
||||||
|
@ -11,7 +11,7 @@ else:
|
|||||||
sys.path.append("so-vits-svc-40v2")
|
sys.path.append("so-vits-svc-40v2")
|
||||||
|
|
||||||
import io
|
import io
|
||||||
from dataclasses import dataclass, asdict
|
from dataclasses import dataclass, asdict, field
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
@ -29,7 +29,7 @@ providers = ['OpenVINOExecutionProvider', "CUDAExecutionProvider", "DmlExecution
|
|||||||
@dataclass
|
@dataclass
|
||||||
class SoVitsSvc40v2Settings():
|
class SoVitsSvc40v2Settings():
|
||||||
gpu: int = 0
|
gpu: int = 0
|
||||||
dstId: int = 0
|
dstId: int = -1
|
||||||
|
|
||||||
f0Detector: str = "dio" # dio or harvest
|
f0Detector: str = "dio" # dio or harvest
|
||||||
tran: int = 20
|
tran: int = 20
|
||||||
@ -44,6 +44,10 @@ class SoVitsSvc40v2Settings():
|
|||||||
onnxModelFile: str = ""
|
onnxModelFile: str = ""
|
||||||
configFile: str = ""
|
configFile: str = ""
|
||||||
|
|
||||||
|
speakers: dict[str, int] = field(
|
||||||
|
default_factory=lambda: {}
|
||||||
|
)
|
||||||
|
|
||||||
# ↓mutableな物だけ列挙
|
# ↓mutableな物だけ列挙
|
||||||
intData = ["gpu", "dstId", "tran", "predictF0", "extraConvertSize"]
|
intData = ["gpu", "dstId", "tran", "predictF0", "extraConvertSize"]
|
||||||
floatData = ["noiceScale", "silentThreshold", "clusterInferRatio"]
|
floatData = ["noiceScale", "silentThreshold", "clusterInferRatio"]
|
||||||
@ -65,38 +69,30 @@ class SoVitsSvc40v2:
|
|||||||
|
|
||||||
self.settings.configFile = config
|
self.settings.configFile = config
|
||||||
self.hps = utils.get_hparams_from_file(config)
|
self.hps = utils.get_hparams_from_file(config)
|
||||||
|
self.settings.speakers = self.hps.spk
|
||||||
|
|
||||||
# hubert model
|
# hubert model
|
||||||
try:
|
try:
|
||||||
# vec_path = hubertTorchModel
|
# vec_path = hubertTorchModel
|
||||||
vec_path = "hubert/checkpoint_best_legacy_500.pt"
|
vec_path = "hubert/checkpoint_best_legacy_500.pt"
|
||||||
print("hubert 1 ", hubertTorchModel)
|
|
||||||
models, saved_cfg, task = checkpoint_utils.load_model_ensemble_and_task(
|
models, saved_cfg, task = checkpoint_utils.load_model_ensemble_and_task(
|
||||||
[vec_path],
|
[vec_path],
|
||||||
suffix="",
|
suffix="",
|
||||||
)
|
)
|
||||||
print("hubert 2 ", hubertTorchModel)
|
|
||||||
model = models[0]
|
model = models[0]
|
||||||
print("hubert 3 ", hubertTorchModel)
|
|
||||||
model.eval()
|
model.eval()
|
||||||
print("hubert 4 ", hubertTorchModel)
|
|
||||||
self.hubert_model = model.cpu()
|
self.hubert_model = model.cpu()
|
||||||
print("hubert 5 ", hubertTorchModel)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("EXCEPTION1", e)
|
print("EXCEPTION during loading hubert/contentvec model", e)
|
||||||
|
|
||||||
# cluster
|
# cluster
|
||||||
try:
|
try:
|
||||||
if os.path.exists(clusterTorchModel):
|
if os.path.exists(clusterTorchModel):
|
||||||
print("load kmean11", clusterTorchModel)
|
|
||||||
self.cluster_model = cluster.get_cluster_model(clusterTorchModel)
|
self.cluster_model = cluster.get_cluster_model(clusterTorchModel)
|
||||||
print("load kmean12", clusterTorchModel)
|
|
||||||
else:
|
else:
|
||||||
print("load kmean21", clusterTorchModel)
|
|
||||||
self.cluster_model = None
|
self.cluster_model = None
|
||||||
print("load kmean22", clusterTorchModel)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("EXCEPTION2", e)
|
print("EXCEPTION during loading cluster model ", e)
|
||||||
|
|
||||||
if pyTorch_model_file != None:
|
if pyTorch_model_file != None:
|
||||||
self.settings.pyTorchModelFile = pyTorch_model_file
|
self.settings.pyTorchModelFile = pyTorch_model_file
|
||||||
|
Loading…
Reference in New Issue
Block a user