Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(train): support ddp in Windows (gloo backend) #394

Merged
merged 1 commit into from
Apr 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/so_vits_svc_fork/train.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import os
import warnings
from logging import getLogger
from multiprocessing import cpu_count
Expand All @@ -10,6 +11,7 @@
import torch
from lightning.pytorch.accelerators import MPSAccelerator, TPUAccelerator
from lightning.pytorch.loggers import TensorBoardLogger
from lightning.pytorch.strategies.ddp import DDPStrategy
from lightning.pytorch.tuner import Tuner
from torch.cuda.amp import autocast
from torch.nn import functional as F
Expand Down Expand Up @@ -75,7 +77,13 @@ def train(

datamodule = VCDataModule(hparams)
strategy = (
"ddp_find_unused_parameters_true" if torch.cuda.device_count() > 1 else "auto"
(
"ddp_find_unused_parameters_true"
if os.name != "nt"
else DDPStrategy(find_unused_parameters=True, process_group_backend="gloo")
)
if torch.cuda.device_count() > 1
else "auto"
)
LOG.info(f"Using strategy: {strategy}")
trainer = pl.Trainer(
Expand Down