Skip to content

Commit

Permalink
Minor bug fixes and changes for improved Windows compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomcattwo authored Sep 25, 2021
1 parent 95adc69 commit 7432046
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion demo_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

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:
Expand Down
2 changes: 1 addition & 1 deletion demo_toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

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
Expand Down
10 changes: 5 additions & 5 deletions synthesizer/synthesize.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
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():
Expand Down Expand Up @@ -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)

Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion synthesizer/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from pathlib import Path
import sys
import time
import platform


def np_now(x: torch.Tensor): return x.detach().cpu().numpy()
Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions vocoder/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
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):
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion vocoder_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MyFormatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptio

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:
Expand Down

0 comments on commit 7432046

Please sign in to comment.