WIP: save upload models

This commit is contained in:
wataru 2023-05-17 12:37:35 +09:00
parent 1f56a6140a
commit 0379a0ea2e
12 changed files with 1748 additions and 51 deletions

View File

@ -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>

File diff suppressed because one or more lines are too long

View File

@ -1,31 +0,0 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

View File

@ -10,7 +10,7 @@ export type MergeLabRowProps = {
export const MergeLabRow = (_props: MergeLabRowProps) => {
const [mergeElements, setMergeElements] = useState<MergeElement[]>([])
const appState = useAppState()
const [defaultTrans, setDefaultTrans] = useState<number>(0)
const [defaultTune, setDefaultTune] = useState<number>(0)
// スロットが変更されたときの初期化処理
const newSlotChangeKey = useMemo(() => {
@ -52,7 +52,8 @@ export const MergeLabRow = (_props: MergeLabRowProps) => {
const onMergeClicked = async () => {
appState.serverSetting.mergeModel({
command: "mix",
defaultTrans: defaultTrans,
defaultTune: defaultTune,
defaultIndexRatio: 1,
files: mergeElements
})
}
@ -98,10 +99,10 @@ export const MergeLabRow = (_props: MergeLabRowProps) => {
<div className="merge-field">
<div className="merge-field-elem grey-bold">Default Tune</div>
<div className="merge-field-elem">
<input type="range" className="body-item-input-slider-2nd" min="-50" max="50" step="1" value={defaultTrans} onChange={(e) => {
setDefaultTrans(Number(e.target.value))
<input type="range" className="body-item-input-slider-2nd" min="-50" max="50" step="1" value={defaultTune} onChange={(e) => {
setDefaultTune(Number(e.target.value))
}}></input>
<span className="body-item-input-slider-val">{defaultTrans}</span>
<span className="body-item-input-slider-val">{defaultTune}</span>
</div>
</div >
@ -112,7 +113,7 @@ export const MergeLabRow = (_props: MergeLabRowProps) => {
</div>
</div>
)
}, [mergeElements, appState.serverSetting.serverSetting, defaultTrans])
}, [mergeElements, appState.serverSetting.serverSetting, defaultTune])
return mergeLabRow

View File

@ -501,6 +501,7 @@ export type MergeElement = {
}
export type MergeModelRequest = {
command: "mix",
defaultTrans: number,
defaultTune: number,
defaultIndexRatio: number,
files: MergeElement[]
}

View File

@ -14,6 +14,7 @@ export type FileUploadSetting = {
isHalf: boolean
uploaded: boolean
defaultTune: number
defaultIndexRatio: number
framework: Framework
params: string
@ -45,6 +46,7 @@ const InitialFileUploadSetting: FileUploadSetting = {
isHalf: true,
uploaded: false,
defaultTune: 0,
defaultIndexRatio: 1,
framework: Framework.PyTorch,
params: "{}",
@ -365,7 +367,8 @@ export const useServerSetting = (props: UseServerSettingProps): ServerSettingSta
// const configFileName = fileUploadSetting.configFile?.filename || "-"
const params = JSON.stringify({
trans: fileUploadSetting.defaultTune || 0,
defaultTune: fileUploadSetting.defaultTune || 0,
defaultIndexRatio: fileUploadSetting.defaultIndexRatio || 1,
sampleId: fileUploadSetting.isSampleMode ? fileUploadSetting.sampleId || "" : "",
files: fileUploadSetting.isSampleMode ? {} : {
mmvcv13Config: fileUploadSetting.mmvcv13Config?.filename || "",
@ -424,6 +427,7 @@ export const useServerSetting = (props: UseServerSettingProps): ServerSettingSta
isHalf: fileUploadSetting.isHalf, // キャッシュとしては不使用。guiで上書きされる。
uploaded: false, // キャッシュから読み込まれるときには、まだuploadされていないから。
defaultTune: fileUploadSetting.defaultTune,
defaultIndexRatio: fileUploadSetting.defaultIndexRatio,
framework: fileUploadSetting.framework,
params: fileUploadSetting.params,

Binary file not shown.

View File

@ -32,7 +32,7 @@
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/kikoto_mahiro_song/KikotoMahiro_Song.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/kikoto_mahiro_song/added_IVF3621_Flat_nprobe_11.index.bin",
"featureUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/kikoto_mahiro_song/total_fea.npy",
"termOfUseUrl": "https://huggingface.co/wok000/vcclient_model/blob/main/rvc/kikoto_mahiro_song/term_of_use.txt",
"termOfUseUrl": "https://huggingface.co/wok000/vcclient_model/raw/main/rvc/kikoto_mahiro_song/term_of_use.txt",
"credit": "黄琴まひろ",
"description": ""
},
@ -92,9 +92,21 @@
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_tylor/amitaro_hubertjp_768_tylor-100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_tylor/amitaro_hubertjp_768_tylor.0.index.bin",
"featureUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_tylor/amitaro_hubertjp_768_tylor.0.big.npy",
"termOfUseUrl": "https://huggingface.co/wok000/vcclient_model/blob/main/rvc/amitaro_hubertjp_768_tylor/term_of_use.txt",
"termOfUseUrl": "https://huggingface.co/wok000/vcclient_model/raw/main/rvc/amitaro_hubertjp_768_tylor/term_of_use.txt",
"credit": "あみたろ",
"description": ""
},
{
"id": "Tsukuyomi-chan",
"lang": "ja-JP",
"tag": "",
"name": "つくよみちゃん",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tsukuyomi-chan_hubertjp_768_default/tsukuyomi_hubertjp_768_def-100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tsukuyomi-chan_hubertjp_768_default/tsukuyomi_hubertjp_768_def.0.index.bin",
"featureUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tsukuyomi-chan_hubertjp_768_default/tsukuyomi_hubertjp_768_def.0.big.npy",
"termOfUseUrl": "https://huggingface.co/wok000/vcclient_model/raw/main/rvc/tsukuyomi-chan_hubertjp_768_default/term_of_use.txt",
"credit": "つくよみちゃん",
"description": ""
}
]
}

View File

@ -10,7 +10,8 @@ class ModelSlot:
modelFile: str = ""
featureFile: str = ""
indexFile: str = ""
defaultTrans: int = 0
defaultTune: int = 0
defaultIndexRatio: int = 1
isONNX: bool = False
modelType: EnumInferenceTypes = EnumInferenceTypes.pyTorchRVC
samplingRate: int = -1

View File

@ -31,7 +31,10 @@ def generateModelSlot(slotDir: str):
else:
modelSlot.indexFile = None
modelSlot.defaultTrans = params["trans"] if "trans" in params else 0
modelSlot.defaultTune = params["defaultTune"] if "defaultTune" in params else 0
modelSlot.defaultIndexRatio = (
params["defaultIndexRatio"] if "defaultIndexRatio" in params else 0
)
modelSlot.name = params["name"] if "name" in params else None
modelSlot.description = params["description"] if "description" in params else None
modelSlot.credit = params["credit"] if "credit" in params else None

View File

@ -92,9 +92,7 @@ class RVC:
def getSampleInfo(self, id: str):
sampleInfos = list(filter(lambda x: x.id == id, self.settings.sampleModels))
print("SAMPLE INFOS 1:", sampleInfos)
if len(sampleInfos) > 0:
print("SAMPLE INFOS 2:", sampleInfos)
return sampleInfos[0]
else:
None
@ -268,7 +266,8 @@ class RVC:
)
# その他の設定
self.next_trans = modelSlot.defaultTrans
self.next_trans = modelSlot.defaultTune
self.next_index_ratio = modelSlot.defaultIndexRatio
self.next_samplingRate = modelSlot.samplingRate
self.next_framework = "ONNX" if modelSlot.isONNX else "PyTorch"
self.needSwitch = True
@ -279,6 +278,7 @@ class RVC:
print("[Voice Changer] Switching model..")
self.pipeline = self.next_pipeline
self.settings.tran = self.next_trans
self.settings.indexRatio = self.next_index_ratio
self.settings.modelSamplingRate = self.next_samplingRate
self.settings.framework = self.next_framework
@ -428,7 +428,12 @@ class RVC:
storeFile = os.path.join(storeDir, "merged.pth")
torch.save(merged, storeFile)
params = {"trans": req.defaultTrans, "files": {"rvcModel": storeFile}}
params = {
"defaultTune": req.defaultTune,
"defaultIndexRatio": req.defaultIndexRatio,
"sampleId": "",
"files": {"rvcModel": storeFile},
}
props: LoadModelParams = LoadModelParams(
slot=targetSlot, isHalf=True, params=params
)

View File

@ -15,5 +15,6 @@ class MergeFile:
class MergeModelRequest:
command: str = ""
slot: int = -1
defaultTrans: int = 0
defaultTune: int = 0
defaultIndexRatio: int = 1
files: List[MergeFile] = field(default_factory=lambda: [])