mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-01-23 13:35:12 +03:00
add logger
This commit is contained in:
parent
3c54b6bd2b
commit
2e84fa7407
2
.gitignore
vendored
2
.gitignore
vendored
@ -56,7 +56,7 @@ server/samples_0003_d2.json
|
|||||||
|
|
||||||
server/test_official_v1_v2.json
|
server/test_official_v1_v2.json
|
||||||
server/test_ddpn_v1_v2.json
|
server/test_ddpn_v1_v2.json
|
||||||
|
server/vvclient.log
|
||||||
start_trainer.sh
|
start_trainer.sh
|
||||||
|
|
||||||
# venv
|
# venv
|
||||||
|
@ -11,6 +11,7 @@ type ErrorBoundaryState = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
||||||
|
// @ts-ignore
|
||||||
private eventHandler: () => void;
|
private eventHandler: () => void;
|
||||||
constructor(props: ErrorBoundaryProps) {
|
constructor(props: ErrorBoundaryProps) {
|
||||||
super(props);
|
super(props);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from distutils.util import strtobool
|
from distutils.util import strtobool
|
||||||
@ -26,7 +27,8 @@ import subprocess
|
|||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
from mods.log_control import setup_loggers
|
from mods.log_control import setup_loggers
|
||||||
|
|
||||||
setup_loggers()
|
setup_loggers(f"Booting PHASE :{__name__}")
|
||||||
|
logger = logging.getLogger("vcclient")
|
||||||
|
|
||||||
|
|
||||||
def setupArgParser():
|
def setupArgParser():
|
||||||
@ -127,6 +129,8 @@ if __name__ == "__mp_main__":
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
mp.freeze_support()
|
mp.freeze_support()
|
||||||
|
|
||||||
|
logger.info(args)
|
||||||
|
|
||||||
printMessage(f"PYTHON:{sys.version}", level=2)
|
printMessage(f"PYTHON:{sys.version}", level=2)
|
||||||
printMessage("Voice Changerを起動しています。", level=2)
|
printMessage("Voice Changerを起動しています。", level=2)
|
||||||
# ダウンロード(Weight)
|
# ダウンロード(Weight)
|
||||||
@ -135,12 +139,14 @@ if __name__ == "__main__":
|
|||||||
except WeightDownladException:
|
except WeightDownladException:
|
||||||
printMessage("RVC用のモデルファイルのダウンロードに失敗しました。", level=2)
|
printMessage("RVC用のモデルファイルのダウンロードに失敗しました。", level=2)
|
||||||
printMessage("failed to download weight for rvc", level=2)
|
printMessage("failed to download weight for rvc", level=2)
|
||||||
|
logger.warn("failed to download weight for rvc")
|
||||||
|
|
||||||
# ダウンロード(Sample)
|
# ダウンロード(Sample)
|
||||||
try:
|
try:
|
||||||
downloadInitialSamples(args.sample_mode, args.model_dir)
|
downloadInitialSamples(args.sample_mode, args.model_dir)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("[Voice Changer] loading sample failed", e)
|
print("[Voice Changer] loading sample failed", e)
|
||||||
|
logger.warn(f"[Voice Changer] loading sample failed {e}",)
|
||||||
|
|
||||||
# PORT = args.p
|
# PORT = args.p
|
||||||
|
|
||||||
@ -233,12 +239,12 @@ if __name__ == "__main__":
|
|||||||
p.start()
|
p.start()
|
||||||
try:
|
try:
|
||||||
if sys.platform.startswith("win"):
|
if sys.platform.startswith("win"):
|
||||||
process = subprocess.Popen([NATIVE_CLIENT_FILE_WIN, "-u", f"http://localhost:{PORT}/"])
|
process = subprocess.Popen([NATIVE_CLIENT_FILE_WIN, "--disable-gpu", "-u", f"http://localhost:{PORT}/"])
|
||||||
return_code = process.wait()
|
return_code = process.wait()
|
||||||
print("client closed.")
|
print("client closed.")
|
||||||
p.terminate()
|
p.terminate()
|
||||||
elif sys.platform.startswith("darwin"):
|
elif sys.platform.startswith("darwin"):
|
||||||
process = subprocess.Popen([NATIVE_CLIENT_FILE_MAC, "-u", f"http://localhost:{PORT}/"])
|
process = subprocess.Popen([NATIVE_CLIENT_FILE_MAC, "--disable-gpu", "-u", f"http://localhost:{PORT}/"])
|
||||||
return_code = process.wait()
|
return_code = process.wait()
|
||||||
print("client closed.")
|
print("client closed.")
|
||||||
p.terminate()
|
p.terminate()
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
|
|
||||||
@ -5,6 +6,8 @@ from downloader.Downloader import download
|
|||||||
from voice_changer.utils.VoiceChangerParams import VoiceChangerParams
|
from voice_changer.utils.VoiceChangerParams import VoiceChangerParams
|
||||||
from Exceptions import WeightDownladException
|
from Exceptions import WeightDownladException
|
||||||
|
|
||||||
|
logger = logging.getLogger("vcclient")
|
||||||
|
|
||||||
|
|
||||||
def downloadWeight(voiceChangerParams: VoiceChangerParams):
|
def downloadWeight(voiceChangerParams: VoiceChangerParams):
|
||||||
content_vec_500_onnx = voiceChangerParams.content_vec_500_onnx
|
content_vec_500_onnx = voiceChangerParams.content_vec_500_onnx
|
||||||
@ -16,6 +19,9 @@ def downloadWeight(voiceChangerParams: VoiceChangerParams):
|
|||||||
crepe_onnx_tiny = voiceChangerParams.crepe_onnx_tiny
|
crepe_onnx_tiny = voiceChangerParams.crepe_onnx_tiny
|
||||||
rmvpe = voiceChangerParams.rmvpe
|
rmvpe = voiceChangerParams.rmvpe
|
||||||
|
|
||||||
|
weight_files = [content_vec_500_onnx, hubert_base, hubert_base_jp, hubert_soft,
|
||||||
|
nsf_hifigan, crepe_onnx_full, crepe_onnx_tiny, rmvpe]
|
||||||
|
|
||||||
# file exists check (currently only for rvc)
|
# file exists check (currently only for rvc)
|
||||||
downloadParams = []
|
downloadParams = []
|
||||||
if os.path.exists(hubert_base) is False:
|
if os.path.exists(hubert_base) is False:
|
||||||
@ -109,3 +115,12 @@ def downloadWeight(voiceChangerParams: VoiceChangerParams):
|
|||||||
|
|
||||||
if os.path.exists(hubert_base) is False or os.path.exists(hubert_base_jp) is False or os.path.exists(hubert_soft) is False or os.path.exists(nsf_hifigan) is False or os.path.exists(nsf_hifigan_config) is False:
|
if os.path.exists(hubert_base) is False or os.path.exists(hubert_base_jp) is False or os.path.exists(hubert_soft) is False or os.path.exists(nsf_hifigan) is False or os.path.exists(nsf_hifigan_config) is False:
|
||||||
raise WeightDownladException()
|
raise WeightDownladException()
|
||||||
|
|
||||||
|
# ファイルサイズをログに書き込む。(デバッグ用)
|
||||||
|
for weight in weight_files:
|
||||||
|
if os.path.exists(weight):
|
||||||
|
file_size = os.path.getsize(weight)
|
||||||
|
logger.info(f"weight file [{weight}]: {file_size}")
|
||||||
|
else:
|
||||||
|
logger.warn(f"weight file is missing. {weight}")
|
||||||
|
raise WeightDownladException()
|
||||||
|
@ -8,7 +8,7 @@ class UvicornSuppressFilter(logging.Filter):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def setup_loggers():
|
def setup_loggers(startMessage: str):
|
||||||
# logger = logging.getLogger("uvicorn.error")
|
# logger = logging.getLogger("uvicorn.error")
|
||||||
# logger.addFilter(UvicornSuppressFilter())
|
# logger.addFilter(UvicornSuppressFilter())
|
||||||
|
|
||||||
@ -36,3 +36,12 @@ def setup_loggers():
|
|||||||
logger.propagate = False
|
logger.propagate = False
|
||||||
|
|
||||||
logging.getLogger("asyncio").setLevel(logging.WARNING)
|
logging.getLogger("asyncio").setLevel(logging.WARNING)
|
||||||
|
|
||||||
|
logger = logging.getLogger("vcclient")
|
||||||
|
logger.setLevel(logging.INFO)
|
||||||
|
fh = logging.FileHandler('vvclient.log', encoding='utf-8')
|
||||||
|
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||||
|
fh.setFormatter(formatter)
|
||||||
|
fh.setLevel(logging.INFO)
|
||||||
|
logger.addHandler(fh)
|
||||||
|
logger.info(f"Start Logging, {startMessage}")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
from OpenSSL import crypto
|
from OpenSSL import crypto
|
||||||
|
|
||||||
|
|
||||||
def create_self_signed_cert(certfile, keyfile, certargs, cert_dir="."):
|
def create_self_signed_cert(certfile, keyfile, certargs, cert_dir="."):
|
||||||
C_F = os.path.join(cert_dir, certfile)
|
C_F = os.path.join(cert_dir, certfile)
|
||||||
K_F = os.path.join(cert_dir, keyfile)
|
K_F = os.path.join(cert_dir, keyfile)
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
|
import logging
|
||||||
from const import UPLOAD_DIR
|
from const import UPLOAD_DIR
|
||||||
from data.ModelSlot import ModelSlots, loadAllSlotInfo, saveSlotInfo
|
from data.ModelSlot import ModelSlots, loadAllSlotInfo, saveSlotInfo
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
logger = logging.getLogger("vcclient")
|
||||||
|
|
||||||
|
|
||||||
class ModelSlotManager:
|
class ModelSlotManager:
|
||||||
_instance = None
|
_instance = None
|
||||||
@ -11,7 +14,7 @@ class ModelSlotManager:
|
|||||||
def __init__(self, model_dir: str):
|
def __init__(self, model_dir: str):
|
||||||
self.model_dir = model_dir
|
self.model_dir = model_dir
|
||||||
self.modelSlots = loadAllSlotInfo(self.model_dir)
|
self.modelSlots = loadAllSlotInfo(self.model_dir)
|
||||||
print("[MODEL SLOT INFO]", self.modelSlots)
|
logger.info(f"[MODEL SLOT INFO] {self.modelSlots}")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_instance(cls, model_dir: str):
|
def get_instance(cls, model_dir: str):
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
from typing import Any, Union, cast
|
from typing import Any, Union, cast
|
||||||
|
|
||||||
from const import TMP_DIR
|
from const import TMP_DIR
|
||||||
@ -27,6 +28,7 @@ from voice_changer.utils.VoiceChangerParams import VoiceChangerParams
|
|||||||
|
|
||||||
STREAM_INPUT_FILE = os.path.join(TMP_DIR, "in.wav")
|
STREAM_INPUT_FILE = os.path.join(TMP_DIR, "in.wav")
|
||||||
STREAM_OUTPUT_FILE = os.path.join(TMP_DIR, "out.wav")
|
STREAM_OUTPUT_FILE = os.path.join(TMP_DIR, "out.wav")
|
||||||
|
logger = logging.getLogger("vcclient")
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@ -80,6 +82,7 @@ class VoiceChanger(VoiceChangerIF):
|
|||||||
self.onnx_device = onnxruntime.get_device()
|
self.onnx_device = onnxruntime.get_device()
|
||||||
|
|
||||||
print(f"VoiceChanger Initialized (GPU_NUM(cuda):{self.gpu_num}, mps_enabled:{self.mps_enabled}, onnx_device:{self.onnx_device})")
|
print(f"VoiceChanger Initialized (GPU_NUM(cuda):{self.gpu_num}, mps_enabled:{self.mps_enabled}, onnx_device:{self.onnx_device})")
|
||||||
|
logger.info(f"VoiceChanger Initialized (GPU_NUM(cuda):{self.gpu_num}, mps_enabled:{self.mps_enabled}, onnx_device:{self.onnx_device})")
|
||||||
|
|
||||||
def setModel(self, model: Any):
|
def setModel(self, model: Any):
|
||||||
self.voiceChanger = model
|
self.voiceChanger = model
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import logging
|
||||||
from typing import Any, Union
|
from typing import Any, Union
|
||||||
|
|
||||||
from const import TMP_DIR
|
from const import TMP_DIR
|
||||||
@ -37,6 +38,7 @@ from voice_changer.utils.VoiceChangerParams import VoiceChangerParams
|
|||||||
|
|
||||||
STREAM_INPUT_FILE = os.path.join(TMP_DIR, "in.wav")
|
STREAM_INPUT_FILE = os.path.join(TMP_DIR, "in.wav")
|
||||||
STREAM_OUTPUT_FILE = os.path.join(TMP_DIR, "out.wav")
|
STREAM_OUTPUT_FILE = os.path.join(TMP_DIR, "out.wav")
|
||||||
|
logger = logging.getLogger("vcclient")
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@ -90,6 +92,7 @@ class VoiceChangerV2(VoiceChangerIF):
|
|||||||
self.onnx_device = onnxruntime.get_device()
|
self.onnx_device = onnxruntime.get_device()
|
||||||
|
|
||||||
print(f"VoiceChangerV2 Initialized (GPU_NUM(cuda):{self.gpu_num}, mps_enabled:{self.mps_enabled}, onnx_device:{self.onnx_device})")
|
print(f"VoiceChangerV2 Initialized (GPU_NUM(cuda):{self.gpu_num}, mps_enabled:{self.mps_enabled}, onnx_device:{self.onnx_device})")
|
||||||
|
logger.info(f"VoiceChangerV2 Initialized (GPU_NUM(cuda):{self.gpu_num}, mps_enabled:{self.mps_enabled}, onnx_device:{self.onnx_device})")
|
||||||
|
|
||||||
def setModel(self, model: VoiceChangerModel):
|
def setModel(self, model: VoiceChangerModel):
|
||||||
self.voiceChanger = model
|
self.voiceChanger = model
|
||||||
|
Loading…
Reference in New Issue
Block a user