未验证 提交 7432046e 编写于 作者: T Tomcattwo 提交者: GitHub

Minor bug fixes and changes for improved Windows compatibility

上级 95adc699
......@@ -38,7 +38,7 @@ SV2TTS is a three-stage deep learning framework that allows to create a numerica
**Python 3.6 or 3.7** is needed to run the toolbox.
* Install [PyTorch](https://pytorch.org/get-started/locally/) (>=1.0.1).
* Install [PyTorch](https://pytorch.org/get-started/locally/) (>=1.1.0).
* Install [ffmpeg](https://ffmpeg.org/download.html#get-packages).
* Run `pip install -r requirements.txt` to install the remaining necessary packages.
......
......@@ -43,7 +43,7 @@ if __name__ == '__main__':
if args.cpu:
# Hide GPUs from Pytorch to force CPU processing
os.environ["CUDA_VISIBLE_DEVICES"] = ""
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
if not args.no_mp3_support:
try:
......
......@@ -32,7 +32,7 @@ if __name__ == '__main__':
if args.cpu:
# Hide GPUs from Pytorch to force CPU processing
os.environ["CUDA_VISIBLE_DEVICES"] = ""
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
del args.cpu
## Remind the user to download pretrained models if needed
......
......@@ -8,13 +8,13 @@ from synthesizer.utils.symbols import symbols
import numpy as np
from pathlib import Path
from tqdm import tqdm
import platform
def run_synthesis(in_dir, out_dir, model_dir, hparams):
# This generates ground truth-aligned mels for vocoder training
synth_dir = Path(out_dir).joinpath("mels_gta")
synth_dir.mkdir(exist_ok=True)
print(hparams_debug_string(hparams))
print(hparams_debug_string())
# Check for GPU
if torch.cuda.is_available():
......@@ -62,9 +62,9 @@ def run_synthesis(in_dir, out_dir, model_dir, hparams):
dataset = SynthesizerDataset(metadata_fpath, mel_dir, embed_dir, hparams)
data_loader = DataLoader(dataset,
collate_fn=lambda batch: collate_synthesizer(batch, r),
collate_fn=lambda batch: collate_synthesizer(batch, r, hparams),
batch_size=hparams.synthesis_batch_size,
num_workers=2,
num_workers=2 if platform.system() != "Windows" else 0,
shuffle=False,
pin_memory=True)
......@@ -80,7 +80,7 @@ def run_synthesis(in_dir, out_dir, model_dir, hparams):
if device.type == "cuda" and torch.cuda.device_count() > 1:
_, mels_out, _ = data_parallel_workaround(model, texts, mels, embeds)
else:
_, mels_out, _ = model(texts, mels, embeds)
_, mels_out, _, _ = model(texts, mels, embeds)
for j, k in enumerate(idx):
# Note: outputs mel-spectrogram files and target ones have same names, just different folders
......
......@@ -15,6 +15,7 @@ import numpy as np
from pathlib import Path
import sys
import time
import platform
def np_now(x: torch.Tensor): return x.detach().cpu().numpy()
......@@ -146,7 +147,7 @@ def train(run_id: str, syn_dir: str, models_dir: str, save_every: int,
data_loader = DataLoader(dataset,
collate_fn=lambda batch: collate_synthesizer(batch, r, hparams),
batch_size=batch_size,
num_workers=2,
num_workers=2 if platform.system() != "Windows" else 0,
shuffle=True,
pin_memory=True)
......
......@@ -11,7 +11,7 @@ import vocoder.hparams as hp
import numpy as np
import time
import torch
import platform
def train(run_id: str, syn_dir: Path, voc_dir: Path, models_dir: Path, ground_truth: bool,
save_every: int, backup_every: int, force_restart: bool):
......@@ -79,7 +79,7 @@ def train(run_id: str, syn_dir: Path, voc_dir: Path, models_dir: Path, ground_tr
data_loader = DataLoader(dataset,
collate_fn=collate_vocoder,
batch_size=hp.voc_batch_size,
num_workers=2,
num_workers=2 if platform.system() != "Windows" else 0,
shuffle=True,
pin_memory=True)
start = time.time()
......
......@@ -43,7 +43,7 @@ if __name__ == "__main__":
if args.cpu:
# Hide GPUs from Pytorch to force CPU processing
os.environ["CUDA_VISIBLE_DEVICES"] = ""
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
# Verify webrtcvad is available
if not args.no_trim:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册