mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-10-07 23:48:48 +08:00
1.add trained path to scan model path
This commit is contained in:
parent
0357d0c7a4
commit
26c81a14cb
5
.gitignore
vendored
5
.gitignore
vendored
@ -9,4 +9,7 @@ logs
|
||||
reference
|
||||
GPT_weights
|
||||
SoVITS_weights
|
||||
TEMP
|
||||
TEMP
|
||||
app.log
|
||||
gweight.txt
|
||||
sweight.txt
|
@ -8,6 +8,8 @@
|
||||
'''
|
||||
import os, re, logging
|
||||
import LangSegment
|
||||
from pyutils.logs import llog
|
||||
|
||||
logging.getLogger("markdown_it").setLevel(logging.ERROR)
|
||||
logging.getLogger("urllib3").setLevel(logging.ERROR)
|
||||
logging.getLogger("httpcore").setLevel(logging.ERROR)
|
||||
@ -530,19 +532,47 @@ def change_choices():
|
||||
|
||||
pretrained_sovits_name = "GPT_SoVITS/pretrained_models/s2G488k.pth"
|
||||
pretrained_gpt_name = "GPT_SoVITS/pretrained_models/s1bert25hz-2kh-longer-epoch=68e-step=50232.ckpt"
|
||||
SoVITS_weight_root = "SoVITS_weights"
|
||||
GPT_weight_root = "GPT_weights"
|
||||
os.makedirs(SoVITS_weight_root, exist_ok=True)
|
||||
os.makedirs(GPT_weight_root, exist_ok=True)
|
||||
SoVITS_weight_root = ["SoVITS_weights","trained"]
|
||||
GPT_weight_root = ["GPT_weights","trained"]
|
||||
|
||||
for path in SoVITS_weight_root:
|
||||
os.makedirs(path, exist_ok=True)
|
||||
|
||||
for path in GPT_weight_root:
|
||||
os.makedirs(path, exist_ok=True)
|
||||
|
||||
|
||||
def get_weights_names():
|
||||
SoVITS_names = [pretrained_sovits_name]
|
||||
for name in os.listdir(SoVITS_weight_root):
|
||||
if name.endswith(".pth"): SoVITS_names.append("%s/%s" % (SoVITS_weight_root, name))
|
||||
for path in SoVITS_weight_root:
|
||||
llog.info(f"scan model path:{path}")
|
||||
for name in os.listdir(path):
|
||||
llog.info(f"scan sub model path:{name}")
|
||||
#if os.path.isdir(name): no working
|
||||
if os.path.isfile(name):
|
||||
if name.endswith(".pth"): SoVITS_names.append("%s/%s" % (path, name))
|
||||
else:
|
||||
subPath = os.path.join(path, name)
|
||||
for modelName in os.listdir(subPath):
|
||||
if modelName.endswith(".pth"):
|
||||
modelPath = os.path.join(subPath,modelName)
|
||||
llog.info(f"add model path:{modelPath}")
|
||||
SoVITS_names.append(modelPath)
|
||||
|
||||
|
||||
GPT_names = [pretrained_gpt_name]
|
||||
for name in os.listdir(GPT_weight_root):
|
||||
if name.endswith(".ckpt"): GPT_names.append("%s/%s" % (GPT_weight_root, name))
|
||||
for path in GPT_weight_root:
|
||||
for name in os.listdir(path):
|
||||
if os.path.isfile(name):
|
||||
if name.endswith(".ckpt"): GPT_names.append("%s/%s" % (path, name))
|
||||
else:
|
||||
subPath = os.path.join(path, name)
|
||||
for modelName in os.listdir(subPath):
|
||||
if modelName.endswith(".pth"):
|
||||
modelPath = os.path.join(subPath, modelName)
|
||||
llog.info(f"add model path:{modelPath}")
|
||||
GPT_names.append(modelPath)
|
||||
|
||||
return SoVITS_names, GPT_names
|
||||
|
||||
|
||||
|
0
GPT_SoVITS/pyutils/__init__.py
Normal file
0
GPT_SoVITS/pyutils/__init__.py
Normal file
24
GPT_SoVITS/pyutils/logs.py
Normal file
24
GPT_SoVITS/pyutils/logs.py
Normal file
@ -0,0 +1,24 @@
|
||||
import logging
|
||||
from logging.handlers import RotatingFileHandler
|
||||
|
||||
# 设置日志记录器
|
||||
llog = logging.getLogger(__name__)
|
||||
llog.setLevel(logging.INFO)
|
||||
llog.propagate = False # 防止日志事件传递给根记录器
|
||||
|
||||
# 创建控制台日志处理器
|
||||
console_handler = logging.StreamHandler()
|
||||
console_handler.setLevel(logging.INFO)
|
||||
|
||||
# 创建文件日志处理器
|
||||
file_handler = RotatingFileHandler('app.log', maxBytes=1024 * 1024 * 10, backupCount=5)
|
||||
file_handler.setLevel(logging.INFO)
|
||||
|
||||
# 设置日志格式,包括文件名和行号
|
||||
formatter = logging.Formatter('%(asctime)s - %(filename)s:%(lineno)d - %(levelname)s - %(message)s')
|
||||
console_handler.setFormatter(formatter)
|
||||
file_handler.setFormatter(formatter)
|
||||
|
||||
# 将处理器添加到日志记录器
|
||||
llog.addHandler(console_handler)
|
||||
#llog.addHandler(file_handler)
|
@ -1,17 +1,14 @@
|
||||
import os
|
||||
import glob
|
||||
import sys
|
||||
import argparse
|
||||
import logging
|
||||
import glob
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
import librosa
|
||||
import numpy as np
|
||||
from scipy.io.wavfile import read
|
||||
import torch
|
||||
import logging
|
||||
|
||||
logging.getLogger("numba").setLevel(logging.ERROR)
|
||||
logging.getLogger("matplotlib").setLevel(logging.ERROR)
|
||||
|
1
docs/cn/inference_cpu.md
Normal file
1
docs/cn/inference_cpu.md
Normal file
@ -0,0 +1 @@
|
||||
# 使用cpu推理
|
3
trained/.gitignore
vendored
Normal file
3
trained/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
*
|
||||
!.gitignore
|
||||
!character_info.json
|
Loading…
x
Reference in New Issue
Block a user