fix:sample

This commit is contained in:
wataru 2023-05-25 11:40:37 +09:00
parent 3037c3d2f9
commit d98168ebbe
16 changed files with 2928 additions and 1769 deletions

View File

@ -67,6 +67,10 @@
"name": "sampleModelSelect",
"options": {}
},
{
"name": "sampleDownloadControlRow",
"options": {}
},
{
"name": "defaultTuneRow2",
"options": {}

View File

@ -1,10 +1 @@
<!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>
<!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>

File diff suppressed because one or more lines are too long

2783
client/demo/dist/index.js.LICENSE.txt vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -67,6 +67,10 @@
"name": "sampleModelSelect",
"options": {}
},
{
"name": "sampleDownloadControlRow",
"options": {}
},
{
"name": "defaultTuneRow2",
"options": {}

View File

@ -55,6 +55,7 @@ import { DiffSettingRow, DiffSettingRowProps } from "./components/612_DiffSettin
import { DiffMethodRow, DiffMethodRowProps } from "./components/613_DiffMethodRow"
import { ServerOpertationRow, ServerOpertationRowProps } from "./components/207_ServerOpertationRow"
import { SampleModelSelectRow, SampleModelSelectRowProps } from "./components/301-j_SampleModelSelectRow"
import { SampleDownloadControlRow, SampleDownloadControlRowProps } from "./components/301-k_SampleDownloadControl"
export const catalog: { [key: string]: (props: any) => JSX.Element } = {}
@ -94,6 +95,7 @@ const initialize = () => {
addToCatalog("modelSlotRow2", (props: ModelSlotRow2Props) => { return <ModelSlotRow2 {...props} /> })
addToCatalog("defaultTuneRow2", (props: DefaultTuneRow2Props) => { return <DefaultTuneRow2 {...props} /> })
addToCatalog("sampleModelSelect", (props: SampleModelSelectRowProps) => { return <SampleModelSelectRow {...props} /> })
addToCatalog("sampleDownloadControlRow", (props: SampleDownloadControlRowProps) => { return <SampleDownloadControlRow {...props} /> })

View File

@ -0,0 +1,36 @@
import React, { useMemo, useState } from "react"
import { useAppState } from "../../../001_provider/001_AppStateProvider"
import { useGuiState } from "../001_GuiStateProvider"
export type SampleDownloadControlRowProps = {}
export const SampleDownloadControlRow = (_props: SampleDownloadControlRowProps) => {
const appState = useAppState()
const guiState = useGuiState()
const sampleDownloadControlRow = useMemo(() => {
const slot = guiState.modelSlotNum
const fileUploadSetting = appState.serverSetting.fileUploadSettings[slot]
if (!fileUploadSetting) {
return <></>
}
if (fileUploadSetting.isSampleMode == false) {
return <></>
}
return (
<div className="body-row split-3-3-4 left-padding-1 guided">
<div className="body-item-title left-padding-1 ">Advanced Configuration</div>
<div>
<input type="checkbox" checked={fileUploadSetting.rvcIndexDownload} onChange={(e) => {
appState.serverSetting.setFileUploadSetting(slot, { ...fileUploadSetting, rvcIndexDownload: e.target.checked })
}} /> useIndex
</div>
<div className="body-button-container">
</div>
</div>
)
}, [appState.serverSetting.fileUploadSettings, appState.serverSetting.setFileUploadSetting])
return sampleDownloadControlRow
}

View File

@ -1,12 +1,12 @@
{
"name": "@dannadori/voice-changer-client-js",
"version": "1.0.132",
"version": "1.0.133",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@dannadori/voice-changer-client-js",
"version": "1.0.132",
"version": "1.0.133",
"license": "ISC",
"dependencies": {
"@types/readable-stream": "^2.3.15",

View File

@ -1,6 +1,6 @@
{
"name": "@dannadori/voice-changer-client-js",
"version": "1.0.132",
"version": "1.0.133",
"description": "",
"main": "dist/index.js",
"directories": {

View File

@ -34,6 +34,7 @@ export type FileUploadSetting = {
isSampleMode: boolean
sampleId: string | null
rvcIndexDownload: boolean
ddspSvcModel: ModelData | null
ddspSvcModelConfig: ModelData | null
@ -66,6 +67,8 @@ const InitialFileUploadSetting: FileUploadSetting = {
isSampleMode: false,
sampleId: null,
rvcIndexDownload: true,
ddspSvcModel: null,
ddspSvcModelConfig: null,
@ -370,6 +373,7 @@ export const useServerSetting = (props: UseServerSettingProps): ServerSettingSta
defaultTune: fileUploadSetting.defaultTune || 0,
defaultIndexRatio: fileUploadSetting.defaultIndexRatio || 1,
sampleId: fileUploadSetting.isSampleMode ? fileUploadSetting.sampleId || "" : "",
rvcIndexDownload: fileUploadSetting.rvcIndexDownload || false,
files: fileUploadSetting.isSampleMode ? {} : {
mmvcv13Config: fileUploadSetting.mmvcv13Config?.filename || "",
mmvcv13Model: fileUploadSetting.mmvcv13Model?.filename || "",
@ -452,6 +456,7 @@ export const useServerSetting = (props: UseServerSettingProps): ServerSettingSta
isSampleMode: fileUploadSetting.isSampleMode,
sampleId: fileUploadSetting.sampleId,
rvcIndexDownload: fileUploadSetting.rvcIndexDownload,
}
setItem(`${INDEXEDDB_KEY_MODEL_DATA}_${slot}`, saveData)
} catch (e) {

View File

@ -1,4 +1,4 @@
from dataclasses import dataclass
from dataclasses import dataclass, field
import json
from const import ModelType
@ -8,7 +8,7 @@ from const import ModelType
class RVCModelSample:
id: str = ""
lang: str = ""
tag: str = ""
tag: list[str] = field(default_factory=lambda: [])
name: str = ""
modelUrl: str = ""
indexUrl: str = ""

View File

@ -101,6 +101,8 @@ class ServerAudioDeviceTypes(Enum):
SAMPLES_JSONS = [
# "https://huggingface.co/wok000/vcclient_model/raw/main/samples_0001.json",
# "https://huggingface.co/wok000/vcclient_model/raw/main/samples_0002.json",
"https://huggingface.co/wok000/vcclient_model/raw/main/samples_0003_t.json",
"https://huggingface.co/wok000/vcclient_model/raw/main/samples_0003_o.json",
]

View File

@ -3,7 +3,7 @@
{
"id": "KikotoKurage",
"lang": "ja-JP",
"tag": "",
"tag": ["torch", "test"],
"name": "黄琴海月",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/kikoto_kurage_48k_256/kikoto_kurage.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/kikoto_kurage_48k_256/added_IVF2997_Flat_nprobe_11.index.bin",
@ -18,7 +18,7 @@
{
"id": "KikotoMahiro",
"lang": "ja-JP",
"tag": "",
"tag": ["torch", "test"],
"name": "黄琴まひろ",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/kikoto_mahiro_48k_256/kikoto_mahiro.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/kikoto_mahiro_48k_256/added_IVF4833_Flat_nprobe_12.index.bin",
@ -33,7 +33,7 @@
{
"id": "TokinaShigure",
"lang": "ja-JP",
"tag": "",
"tag": ["torch", "test"],
"name": "刻鳴時雨",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tokina_sigure/Shigure.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tokina_sigure/added_IVF1572_Flat_nprobe_9.index.bin",
@ -48,7 +48,7 @@
{
"id": "Amitaro",
"lang": "ja-JP",
"tag": "",
"tag": ["torch", "test"],
"name": "あみたろ",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_contentvec_256/amitaro48k-100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_contentvec_256/amitaro48k.0.index.bin",
@ -63,7 +63,7 @@
{
"id": "Amitaro_768d",
"lang": "ja-JP",
"tag": "",
"tag": ["torch", "test"],
"name": "あみたろ(768d)",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_default/amitaro_hubertjp_768_def-100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_default/amitaro_hubertjp_768_def.0.index.bin",
@ -78,7 +78,7 @@
{
"id": "Amitaro_768n",
"lang": "ja-JP",
"tag": "",
"tag": ["torch", "test"],
"name": "あみたろ(768n)",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_nadare/amitaro_hubert_jp-100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_nadare/amitaro_hubert_jp.0.index.bin",
@ -93,7 +93,7 @@
{
"id": "Amitaro_768t",
"lang": "ja-JP",
"tag": "",
"tag": ["torch", "test"],
"name": "あみたろ(768t)",
"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",
@ -108,7 +108,7 @@
{
"id": "Tsukuyomi-chan_768d",
"lang": "ja-JP",
"tag": "",
"tag": ["torch", "test"],
"name": "つくよみちゃん(768d)",
"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",
@ -123,7 +123,7 @@
{
"id": "Tsukuyomi-chan",
"lang": "ja-JP",
"tag": "",
"tag": ["torch", "test"],
"name": "つくよみちゃん",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tsukuyomi_contentvec_256/tsukuyomi48k-100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tsukuyomi_contentvec_256/tsukuyomi48k.0.index.bin",

View File

@ -3,7 +3,7 @@
{
"id": "KikotoKurage_v2",
"lang": "ja-JP",
"tag": "",
"tag": ["torch", "test"],
"name": "黄琴海月_v2",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/kikoto_kurage/kikoto_kurage_v2_40k_e100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/kikoto_kurage/added_IVF5181_Flat_nprobe_1_v2.index.bin",
@ -18,7 +18,7 @@
{
"id": "KikotoMahiro_v2",
"lang": "ja-JP",
"tag": "",
"tag": ["torch", "test"],
"name": "黄琴まひろ_v2",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/kikoto_mahiro/kikoto_mahiro_v2_40k.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/kikoto_mahiro/added_IVF6881_Flat_nprobe_1_v2.index.bin",
@ -33,7 +33,7 @@
{
"id": "TokinaShigure_v2",
"lang": "ja-JP",
"tag": "",
"tag": ["torch", "test"],
"name": "刻鳴時雨_v2",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/tokina_shigure/tokina_shigure_v2_40k_e100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/tokina_shigure/added_IVF2736_Flat_nprobe_1_v2.index.bin",
@ -48,7 +48,7 @@
{
"id": "Amitaro_v2",
"lang": "ja-JP",
"tag": "",
"tag": ["torch", "test"],
"name": "あみたろ_v2",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/amitaro/amitaro_v2_40k_e100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/amitaro/added_IVF3139_Flat_nprobe_1_v2.index.bin",
@ -63,7 +63,7 @@
{
"id": "Tsukuyomi-chan_v2",
"lang": "ja-JP",
"tag": "",
"tag": ["torch", "test"],
"name": "つくよみちゃん_v2",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/tsukuyomi-chan/tsukuyomi_v2_40k_e100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/tsukuyomi-chan/added_IVF7852_Flat_nprobe_1_v2.index.bin",

View File

@ -111,11 +111,14 @@ class RVC:
print("loadModel", params)
# サンプルが指定されたときはダウンロードしてメタデータをでっちあげる
if len(params["sampleId"]) > 0:
sampleInfo = self.getSampleInfo(params["sampleId"])
sampleId = params["sampleId"]
sampleInfo = self.getSampleInfo(sampleId)
useIndex = params["rvcIndexDownload"]
if sampleInfo is None:
print("[Voice Changer] sampleInfo is None")
return
modelPath, indexPath = downloadModelFiles(sampleInfo)
modelPath, indexPath = downloadModelFiles(sampleInfo, useIndex)
params["files"]["rvcModel"] = modelPath
if indexPath is not None:
params["files"]["rvcIndex"] = indexPath

View File

@ -16,10 +16,10 @@ def checkRvcModelExist(model_dir: str):
def downloadInitialSampleModels(sampleJsons: list[str], model_dir: str):
sampleModelIds = [
"KikotoMahiro_o",
"TokinaShigure_o",
"Amitaro_o",
"Tsukuyomi-chan_o",
("TokinaShigure_o", True),
("KikotoMahiro_o", False),
("Amitaro_o", False),
("Tsukuyomi-chan_o", False),
]
sampleModels = getModelSamples(sampleJsons, "RVC")
if sampleModels is None:
@ -28,8 +28,19 @@ def downloadInitialSampleModels(sampleJsons: list[str], model_dir: str):
downloadParams = []
slot_count = 0
line_num = 0
for initSampleId in sampleModelIds:
print(initSampleId)
# 初期サンプルをサーチ
match = False
for sample in sampleModels:
if sample.id in sampleModelIds:
if sample.id == initSampleId[0]:
match = True
break
if match is False:
print(f"[Voice Changer] initiail sample not found. {initSampleId[0]}")
continue
# 検出されたら、、、
sampleParams: Any = {"files": {}}
slotDir = os.path.join(model_dir, RVC_MODEL_DIRNAME, str(slot_count))
@ -48,7 +59,11 @@ def downloadInitialSampleModels(sampleJsons: list[str], model_dir: str):
sampleParams["files"]["rvcModel"] = modelFilePath
line_num += 1
if hasattr(sample, "indexUrl") and sample.indexUrl != "":
if (
initSampleId[1] is True
and hasattr(sample, "indexUrl")
and sample.indexUrl != ""
):
indexPath = os.path.join(
slotDir,
os.path.basename(sample.indexUrl),
@ -84,7 +99,7 @@ def downloadInitialSampleModels(sampleJsons: list[str], model_dir: str):
pool.map(download, downloadParams)
def downloadModelFiles(sampleInfo: RVCModelSample):
def downloadModelFiles(sampleInfo: RVCModelSample, useIndex: bool = True):
downloadParams = []
modelPath = os.path.join(TMP_DIR, os.path.basename(sampleInfo.modelUrl))
@ -97,7 +112,12 @@ def downloadModelFiles(sampleInfo: RVCModelSample):
)
indexPath = None
if hasattr(sampleInfo, "indexUrl") and sampleInfo.indexUrl != "":
if (
useIndex is True
and hasattr(sampleInfo, "indexUrl")
and sampleInfo.indexUrl != ""
):
print("[Voice Changer] Download sample with index.")
indexPath = os.path.join(TMP_DIR, os.path.basename(sampleInfo.indexUrl))
downloadParams.append(
{