Skip to content

Commit

Permalink
Set use_cuda to true if available
Browse files Browse the repository at this point in the history
  • Loading branch information
WeberJulian committed May 30, 2022
1 parent fbb4506 commit 41d86e0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions TTS/bin/compute_embeddings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import argparse
import os
from argparse import RawTextHelpFormatter
import torch

from tqdm import tqdm

Expand All @@ -22,11 +23,13 @@
parser.add_argument("config_dataset_path", type=str, help="Path to dataset config file.")
parser.add_argument("--output_path", type=str, help="Path for output `pth` or `json` file.", default="speakers.pth")
parser.add_argument("--old_file", type=str, help="Previous embedding file to only compute new audios.", default=None)
parser.add_argument("--use_cuda", type=bool, help="flag to set cuda. Default False", default=False)
parser.add_argument("--disable_cuda", type=bool, help="Flag to disable cuda.", default=False)
parser.add_argument("--no_eval", type=bool, help="Do not compute eval?. Default False", default=False)

args = parser.parse_args()

use_cuda = torch.cuda.is_available() and not args.disable_cuda

c_dataset = load_config(args.config_dataset_path)

meta_data_train, meta_data_eval = load_tts_samples(c_dataset.datasets, eval_split=not args.no_eval)
Expand All @@ -40,7 +43,7 @@
encoder_model_path=args.model_path,
encoder_config_path=args.config_path,
d_vectors_file_path=args.old_file,
use_cuda=args.use_cuda,
use_cuda=use_cuda,
)

class_name_key = encoder_manager.encoder_config.class_name_key
Expand Down

0 comments on commit 41d86e0

Please sign in to comment.