Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V.1.5.4 #1046

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

V.1.5.4 #1046

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,15 @@ docker/cudnn/
server/pretrain/
server/weights/
server/model_dir/
server/model_dir2/
server/weights_/
server/weights__/
server/models/
server/samples.json
server/samples_0003_t.json
server/samples_0003_o.json
server/samples_0003_o2.json
server/samples_0003_t2.json

server/test_official_v1_v2.json
server/test_ddpn_v1_v2.json
Expand Down
11 changes: 10 additions & 1 deletion client/demo/dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
<!doctype html><html style="width:100%;height:100%;overflow:hidden"><head><meta charset="utf-8"/><title>Voice Changer Client Demo</title><script defer="defer" src="index.js"></script></head><body style="width:100%;height:100%;margin:0"><div id="app" style="width:100%;height:100%"></div></body></html>
<!DOCTYPE html>
<html style="width: 100%; height: 100%; overflow: hidden">
<head>
<meta charset="utf-8" />
<title>Voice Changer Client Demo</title>
<script defer src="index.js"></script></head>
<body style="width: 100%; height: 100%; margin: 0px">
<div id="app" style="width: 100%; height: 100%"></div>
</body>
</html>
1,904 changes: 1,902 additions & 2 deletions client/demo/dist/index.js

Large diffs are not rendered by default.

31 changes: 0 additions & 31 deletions client/demo/dist/index.js.LICENSE.txt

This file was deleted.

1 change: 0 additions & 1 deletion client/demo/src/001_globalHooks/010_useMessageBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const useMessageBuilder_old = (): MessageBuilderStateAndMethod => {
lang = "en"
}

console.log(messagesRef.current)
return messagesRef.current.find(x => { return x.file == file && x.id == id })?.message[lang] || "unknwon message"
}
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const ModelSlotManagerDialog = () => {
if (mode != "localFile") {
return <></>
}
if (!serverSetting.serverSetting.modelSlots) {
if (!serverSetting.serverSetting.slotInfos) {
return <></>
}

Expand Down Expand Up @@ -114,7 +114,7 @@ export const ModelSlotManagerDialog = () => {
}


const slots = serverSetting.serverSetting.modelSlots.map((x, index) => {
const slots = serverSetting.serverSetting.slotInfos.map((x, index) => {
let modelFileName = ""
if (uploadData?.slot == index) {
modelFileName = (uploadData.model?.name || "").replace(/^.*[\\\/]/, '')
Expand Down Expand Up @@ -248,7 +248,7 @@ export const ModelSlotManagerDialog = () => {

}, [
mode,
serverSetting.serverSetting.modelSlots,
serverSetting.serverSetting.slotInfos,
serverSetting.fileUploadSettings,
serverSetting.uploadProgress,
serverSetting.setFileUploadSetting,
Expand Down
13 changes: 8 additions & 5 deletions client/demo/src/components/demo/905_MergeLabDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,22 @@ export const MergeLabDialog = () => {

// スロットが変更されたときの初期化処理
const newSlotChangeKey = useMemo(() => {
if (!serverSetting.serverSetting.modelSlots) {
if (!serverSetting.serverSetting.slotInfos) {
return ""
}
return serverSetting.serverSetting.modelSlots.reduce((prev, cur) => {
return serverSetting.serverSetting.slotInfos.reduce((prev, cur) => {
return prev + "_" + cur.modelFile
}, "")
}, [serverSetting.serverSetting.modelSlots])
}, [serverSetting.serverSetting.slotInfos])

const filterItems = useMemo(() => {
return serverSetting.serverSetting.modelSlots.reduce((prev, cur) => {
return serverSetting.serverSetting.slotInfos.reduce((prev, cur) => {
const key = `${cur.modelType},${cur.samplingRate},${cur.embChannels}`
const val = { type: cur.modelType, samplingRate: cur.samplingRate, embChannels: cur.embChannels }
const existKeys = Object.keys(prev)
if (cur.voiceChangerType == null) {
return prev
}
if (cur.modelFile.length == 0) {
return prev
}
Expand All @@ -41,7 +44,7 @@ export const MergeLabDialog = () => {
}, [newSlotChangeKey])

const models = useMemo(() => {
return serverSetting.serverSetting.modelSlots.filter(x => {
return serverSetting.serverSetting.slotInfos.filter(x => {
const filterVals = filterItems[currentFilter]
if (!filterVals) {
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export const ModelSwitchRow = (_props: ModelSwitchRowProps) => {
const appState = useAppState()

const modelSwitchRow = useMemo(() => {
const slot = appState.serverSetting.serverSetting.modelSlotIndex
const slot = appState.serverSetting.serverSetting.slotIndex
const onSwitchModelClicked = async (slot: number) => {
// Quick hack for same slot is selected. 下3桁が実際のSlotID
const dummyModelSlotIndex = (Math.floor(Date.now() / 1000)) * 1000 + slot
await appState.serverSetting.updateServerSettings({ ...appState.serverSetting.serverSetting, modelSlotIndex: dummyModelSlotIndex })
await appState.serverSetting.updateServerSettings({ ...appState.serverSetting.serverSetting, slotIndex: dummyModelSlotIndex })
setTimeout(() => { // quick hack
appState.getInfo()
}, 1000 * 2)
Expand All @@ -24,7 +24,7 @@ export const ModelSwitchRow = (_props: ModelSwitchRowProps) => {
}


const modelSlots = appState.serverSetting.serverSetting.modelSlots
const modelSlots = appState.serverSetting.serverSetting.slotInfos
let options: React.JSX.Element[] = []
if (modelSlots) {
options = modelSlots.map((x, index) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,25 @@ export const ModelSlotArea = (_props: ModelSlotAreaProps) => {


const modelTiles = useMemo(() => {
if (!serverSetting.serverSetting.modelSlots) {
if (!serverSetting.serverSetting.slotInfos) {
return []
}
return serverSetting.serverSetting.modelSlots.map((x, index) => {
return serverSetting.serverSetting.slotInfos.map((x, index) => {
if (x.voiceChangerType == null) {
return null
}
if (x.modelFile.length == 0) {
return null
}
const tileContainerClass = index == serverSetting.serverSetting.modelSlotIndex ? "model-slot-tile-container-selected" : "model-slot-tile-container"
const tileContainerClass = index == serverSetting.serverSetting.slotIndex ? "model-slot-tile-container-selected" : "model-slot-tile-container"
const name = x.name.length > 8 ? x.name.substring(0, 7) + "..." : x.name
const iconElem = x.iconFile.length > 0 ?
<img className="model-slot-tile-icon" src={x.iconFile} alt={x.name} /> :
<div className="model-slot-tile-icon-no-entry">no image</div>

const clickAction = async () => {
const dummyModelSlotIndex = (Math.floor(Date.now() / 1000)) * 1000 + index
await serverSetting.updateServerSettings({ ...serverSetting.serverSetting, modelSlotIndex: dummyModelSlotIndex })
await serverSetting.updateServerSettings({ ...serverSetting.serverSetting, slotIndex: dummyModelSlotIndex })
setTimeout(() => { // quick hack
getInfo()
}, 1000 * 2)
Expand All @@ -50,7 +53,7 @@ export const ModelSlotArea = (_props: ModelSlotAreaProps) => {
</div >
)
}).filter(x => x != null)
}, [serverSetting.serverSetting.modelSlots, serverSetting.serverSetting.modelSlotIndex])
}, [serverSetting.serverSetting.slotInfos, serverSetting.serverSetting.slotIndex])


const modelSlotArea = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ export const CharacterArea = (_props: CharacterAreaProps) => {
}, [])

const selected = useMemo(() => {
if (serverSetting.serverSetting.modelSlotIndex == undefined) {
console.log("serverSetting.serverSetting.slotInfos::", serverSetting.serverSetting.slotIndex, serverSetting.serverSetting.slotInfos)
if (serverSetting.serverSetting.slotIndex == undefined) {
return
}
return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex]
}, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots])
return serverSetting.serverSetting.slotInfos[serverSetting.serverSetting.slotIndex]
}, [serverSetting.serverSetting.slotIndex, serverSetting.serverSetting.slotInfos])


useEffect(() => {
Expand Down
1 change: 0 additions & 1 deletion client/demo/src/hooks/useMessageBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const useMessageBuilder = (): MessageBuilderStateAndMethod => {
lang = "en"
}

console.log(messagesRef.current)
return messagesRef.current.find(x => { return x.file == file && x.id == id })?.message[lang] || "unknwon message"
}
return {
Expand Down
10 changes: 3 additions & 7 deletions client/lib/src/ServerConfigurator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ClientType, MergeModelRequest, OnnxExporterInfo, ServerInfo, ServerSettingKey } from "./const";
import { ClientType, MergeModelRequest, OnnxExporterInfo, ServerInfo, ServerSettingKey, VoiceChangerType } from "./const";


type FileChunk = {
Expand Down Expand Up @@ -166,16 +166,12 @@ export class ServerConfigurator {
})
}

loadModel = async (slot: number, isHalf: boolean, params: string = "{}") => {
if (isHalf == undefined || isHalf == null) {
console.warn("isHalf is invalid value", isHalf)
isHalf = false
}
loadModel = async (slot: number, voiceChangerType: VoiceChangerType, params: string = "{}") => {
const url = this.serverUrl + "/load_model"
const info = new Promise<ServerInfo>(async (resolve) => {
const formData = new FormData();
formData.append("slot", "" + slot);
formData.append("isHalf", "" + isHalf);
formData.append("voiceChangerType", voiceChangerType);
formData.append("params", params);

const request = new Request(url, {
Expand Down
6 changes: 3 additions & 3 deletions client/lib/src/VoiceChangerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { VoiceChangerWorkletNode, VoiceChangerWorkletListener } from "./VoiceCha
import workerjs from "raw-loader!../worklet/dist/index.js";
import { VoiceFocusDeviceTransformer, VoiceFocusTransformDevice } from "amazon-chime-sdk-js";
import { createDummyMediaStream, validateUrl } from "./util";
import { ClientType, DefaultVoiceChangerClientSetting, MergeModelRequest, ServerSettingKey, VoiceChangerClientSetting, WorkletNodeSetting, WorkletSetting } from "./const";
import { ClientType, DefaultVoiceChangerClientSetting, MergeModelRequest, ServerSettingKey, VoiceChangerClientSetting, VoiceChangerType, WorkletNodeSetting, WorkletSetting } from "./const";
import { ServerConfigurator } from "./ServerConfigurator";

// オーディオデータの流れ
Expand Down Expand Up @@ -298,10 +298,10 @@ export class VoiceChangerClient {
}
loadModel = (
slot: number,
isHalf: boolean,
voiceChangerType: VoiceChangerType,
params: string,
) => {
return this.configurator.loadModel(slot, isHalf, params)
return this.configurator.loadModel(slot, voiceChangerType, params)
}
uploadAssets = (params: string) => {
return this.configurator.uploadAssets(params)
Expand Down
51 changes: 45 additions & 6 deletions client/lib/src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ export const ClientType = {
} as const
export type ClientType = typeof ClientType[keyof typeof ClientType]

export const VoiceChangerType = {
"MMVCv15": "MMVCv15",
"MMVCv13": "MMVCv13",
"so-vits-svc-40": "so-vits-svc-40",
"DDSP-SVC": "DDSP-SVC",
"RVC": "RVC"
} as const
export type VoiceChangerType = typeof VoiceChangerType[keyof typeof VoiceChangerType]


///////////////////////
// サーバセッティング
///////////////////////
Expand Down Expand Up @@ -122,7 +132,8 @@ export const ServerSettingKey = {
"rvcQuality": "rvcQuality",
"modelSamplingRate": "modelSamplingRate",
"silenceFront": "silenceFront",
"modelSlotIndex": "modelSlotIndex",
// "modelSlotIndex": "modelSlotIndex",
"slotIndex": "slotIndex",

"useEnhancer": "useEnhancer",
"useDiff": "useDiff",
Expand Down Expand Up @@ -181,7 +192,8 @@ export type VoiceChangerServerSetting = {
rvcQuality: number // 0:low, 1:high
silenceFront: number // 0:off, 1:on
modelSamplingRate: ModelSamplingRate // 32000,40000,48000
modelSlotIndex: number,
// modelSlotIndex: number,
slotIndex: number,

useEnhancer: number// DDSP-SVC
useDiff: number// DDSP-SVC
Expand All @@ -197,7 +209,31 @@ export type VoiceChangerServerSetting = {
enableDirectML: number
}

type ModelSlot = {
// type ModelSlot = {
// modelFile: string
// featureFile: string,
// indexFile: string,

// defaultTune: number,
// defaultIndexRatio: number,
// defaultProtect: number,

// modelType: ModelType,
// embChannels: number,
// f0: boolean,
// samplingRate: number
// deprecated: boolean


// name: string,
// description: string,
// credit: string,
// termsOfUseUrl: string,
// iconFile: string
// }

type SlotInfo = {
voiceChangerType: VoiceChangerType | null
modelFile: string
featureFile: string,
indexFile: string,
Expand Down Expand Up @@ -233,7 +269,8 @@ export type ServerInfo = VoiceChangerServerSetting & {
pyTorchModelFile: string,
onnxModelFile: string,
onnxExecutionProviders: OnnxExecutionProvider[]
modelSlots: ModelSlot[]
// modelSlots: ModelSlot[]
slotInfos: SlotInfo[]
serverAudioInputDevices: ServerAudioDevice[]
serverAudioOutputDevices: ServerAudioDevice[]
sampleModels: RVCSampleModel[]
Expand Down Expand Up @@ -311,7 +348,8 @@ export const DefaultServerSetting: ServerInfo = {
rvcQuality: 0,
modelSamplingRate: 48000,
silenceFront: 1,
modelSlotIndex: 0,
// modelSlotIndex: 0,
slotIndex: 0,
sampleModels: [],
gpus: [],

Expand All @@ -331,7 +369,8 @@ export const DefaultServerSetting: ServerInfo = {
pyTorchModelFile: "",
onnxModelFile: "",
onnxExecutionProviders: [],
modelSlots: [],
// modelSlots: [],
slotInfos: [],
serverAudioInputDevices: [],
serverAudioOutputDevices: []
}
Expand Down
Loading
Loading