1
0
mirror of https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git synced 2026-06-05 01:10:22 +08:00

Compare commits

...

5 Commits

Author SHA1 Message Date
源文雨
8ded36e9e1 Merge branch 'dev' of https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI 2026-04-18 17:39:34 +08:00
github-actions[bot]
645ce27dcc chore(format): run black on dev (#143)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-04-18 17:36:44 +08:00
源文雨
3affc9415d fix(train): unsupported gloo device on win 2026-04-18 17:30:48 +08:00
源文雨
cc50ede4fb fix(train): extract f0 & feature hang 2026-04-18 17:03:52 +08:00
fumiama
6a9b026a53 fix(ci): mis-closing of some useful issues 2025-11-18 13:21:30 +08:00
6 changed files with 121 additions and 46 deletions

View File

@@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/stale@v5
with:
exempt-issue-labels: "help wanted,good first issue,documentation,following up,todo list"
exempt-issue-labels: "help wanted,good first issue,documentation,following up,todo list,enhancement"
days-before-issue-stale: 30
days-before-issue-close: 15
stale-issue-label: "stale"

View File

@@ -106,6 +106,12 @@ if __name__ == "__main__":
Config.use_insecure_load()
printt(" ".join(sys.argv))
# GPU methods (rmvpe, fcpe, crepe, etc.) gain nothing from multiprocessing since
# all processes share one GPU. Spawning n_p processes each lazily loading
# the model onto the same CUDA device exhausts VRAM and causes deadlocks.
if "cuda" in device:
printt("WARN: use 1 thread since GPU is used.")
n_p = 1
featureInput = FeatureInput(is_half, device)
paths = []
inp_root = "%s/1_16k_wavs" % (exp_dir)

View File

@@ -17,7 +17,14 @@ device = sys.argv[1]
n_part = int(sys.argv[2])
i_part = int(sys.argv[3])
i_gpu = sys.argv[4]
os.environ["CUDA_VISIBLE_DEVICES"] = str(i_gpu)
# CUDA_VISIBLE_DEVICES expects bare GPU indices (e.g. "0" or "0,1"),
# but callers may pass "cuda:0", "cuda:0-cuda:1", etc. Strip the prefix
# and normalise separators so any combination works.
import re
i_gpu = re.sub(r"cuda:", "", str(i_gpu))
i_gpu = i_gpu.replace("-", ",")
os.environ["CUDA_VISIBLE_DEVICES"] = i_gpu
exp_dir = sys.argv[5]
version = sys.argv[6]
is_half = sys.argv[7].lower() == "true"

View File

@@ -106,23 +106,30 @@ def main():
# patch to unblock people without gpus. there is probably a better way.
print("NO GPU DETECTED: falling back to CPU - this may take a while")
n_gpus = 1
os.environ["MASTER_ADDR"] = "localhost"
os.environ["MASTER_PORT"] = str(randint(20000, 55555))
children = []
logger = utils.get_logger(hps.model_dir)
for i in range(n_gpus):
subproc = mp.Process(
target=run,
args=(i, n_gpus, hps, logger),
)
children.append(subproc)
subproc.start()
if n_gpus == 1:
# Single GPU: run directly without distributed to avoid gloo issues on Windows
run(0, 1, hps, logger)
else:
master_port = str(randint(20000, 55555))
os.environ["MASTER_ADDR"] = "127.0.0.1"
os.environ["MASTER_PORT"] = master_port
children = []
for i in range(n_gpus):
subproc = mp.Process(
target=run,
args=(i, n_gpus, hps, logger, master_port),
)
children.append(subproc)
subproc.start()
for i in range(n_gpus):
children[i].join()
for i in range(n_gpus):
children[i].join()
def run(rank, n_gpus, hps: utils.HParams, logger: logging.Logger):
def run(
rank, n_gpus, hps: utils.HParams, logger: logging.Logger, master_port: str = "29500"
):
global global_step
if rank == 0:
# logger = utils.get_logger(hps.model_dir)
@@ -131,24 +138,81 @@ def run(rank, n_gpus, hps: utils.HParams, logger: logging.Logger):
writer = SummaryWriter(log_dir=hps.model_dir)
writer_eval = SummaryWriter(log_dir=os.path.join(hps.model_dir, "eval"))
try:
dist.init_process_group(
backend=(
"gloo" if os.name == "nt" or not torch.cuda.is_available() else "nccl"
),
init_method="env://",
world_size=n_gpus,
rank=rank,
)
except:
dist.init_process_group(
backend=(
"gloo" if os.name == "nt" or not torch.cuda.is_available() else "nccl"
),
init_method="env://?use_libuv=False",
world_size=n_gpus,
rank=rank,
)
use_distributed = n_gpus > 1
if use_distributed:
if os.name == "nt" or not torch.cuda.is_available():
# On Windows, gloo's create_device(hostname=...) is gated to Linux only
# in the C++ layer (makeDeviceForHostname). We must use the interface-
# based path instead: create_device(interface=...) calls
# makeDeviceForInterface which is not platform-gated.
import socket as _socket
try:
store = dist.TCPStore(
host_name="127.0.0.1",
port=int(master_port),
world_size=n_gpus,
is_master=(rank == 0),
)
except Exception:
store = dist.TCPStore(
host_name="127.0.0.1",
port=int(master_port),
world_size=n_gpus,
is_master=(rank == 0),
use_libuv=False,
)
# Discover a working network interface for gloo device creation
gloo_device = None
try:
for idx, ifname in _socket.if_nameindex():
try:
gloo_device = dist.ProcessGroupGloo.create_device(
interface=ifname
)
print("Try device", idx, "name", ifname)
break
except RuntimeError as e:
print("Try device", idx, "name", ifname, "err:", e)
continue
except (OSError, AttributeError) as e:
print(e.with_traceback(None))
if gloo_device is None:
raise RuntimeError(
"Cannot create gloo device on Windows. "
"No usable network interface found. "
"Try adding your hostname to "
"C:\\Windows\\System32\\drivers\\etc\\hosts "
"with: 127.0.0.1 " + _socket.gethostname()
)
pg_options = dist.ProcessGroupGloo._Options()
pg_options._devices = [gloo_device]
dist.init_process_group(
backend="gloo",
store=store,
world_size=n_gpus,
rank=rank,
pg_options=pg_options,
)
else:
init_url = f"tcp://127.0.0.1:{master_port}"
try:
dist.init_process_group(
backend="nccl",
init_method=init_url,
world_size=n_gpus,
rank=rank,
)
except:
dist.init_process_group(
backend="nccl",
init_method=init_url + "?use_libuv=False",
world_size=n_gpus,
rank=rank,
)
torch.manual_seed(hps.train.seed)
if torch.cuda.is_available():
torch.cuda.set_device(rank)
@@ -221,14 +285,15 @@ def run(rank, n_gpus, hps: utils.HParams, logger: logging.Logger):
)
# net_g = DDP(net_g, device_ids=[rank], find_unused_parameters=True)
# net_d = DDP(net_d, device_ids=[rank], find_unused_parameters=True)
if hasattr(torch, "xpu") and torch.xpu.is_available():
pass
elif torch.cuda.is_available():
net_g = DDP(net_g, device_ids=[rank])
net_d = DDP(net_d, device_ids=[rank])
else:
net_g = DDP(net_g)
net_d = DDP(net_d)
if use_distributed:
if hasattr(torch, "xpu") and torch.xpu.is_available():
pass
elif torch.cuda.is_available():
net_g = DDP(net_g, device_ids=[rank])
net_d = DDP(net_d, device_ids=[rank])
else:
net_g = DDP(net_g)
net_d = DDP(net_d)
try: # 如果能加载自动resume
_, _, _, epoch_str = utils.load_checkpoint(

View File

@@ -40,11 +40,9 @@ app = gr.Blocks()
with app:
with gr.Tabs():
with gr.TabItem("在线demo"):
gr.Markdown(
value="""
gr.Markdown(value="""
RVC 在线demo
"""
)
""")
sid = gr.Dropdown(label=i18n("Inferencing voice"), choices=sorted(names))
with gr.Column():
spk_item = gr.Slider(

1
web.py
View File

@@ -36,7 +36,6 @@ import threading
import shutil
import logging
logging.getLogger("numba").setLevel(logging.WARNING)
logging.getLogger("httpx").setLevel(logging.WARNING)