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

Add device flag to TTS CLI #2875

Merged
merged 1 commit into from
Aug 28, 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
8 changes: 6 additions & 2 deletions TTS/bin/synthesize.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def main():
help="Output wav file path.",
)
parser.add_argument("--use_cuda", type=bool, help="Run model on CUDA.", default=False)
parser.add_argument("--device", type=str, help="Device to run model on.", default="cpu")
parser.add_argument(
"--vocoder_path",
type=str,
Expand Down Expand Up @@ -391,6 +392,10 @@ def main():
if args.encoder_path is not None:
encoder_path = args.encoder_path
encoder_config_path = args.encoder_config_path

device = args.device
if args.use_cuda:
device = "cuda"

# load models
synthesizer = Synthesizer(
Expand All @@ -406,8 +411,7 @@ def main():
vc_config_path,
model_dir,
args.voice_dir,
args.use_cuda,
)
).to(device)

# query speaker ids of a multi-speaker model.
if args.list_speaker_idxs:
Expand Down