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

Use fsspec and torch for embedding file IO #1581

Merged
merged 8 commits into from
Jun 1, 2022
Merged
Changes from 1 commit
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
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)
Copy link
Member Author

@erogol erogol May 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me, this is counter-intuitive but can live with it :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just spent 3h computing phonemes before realizing that it wasn't using the GPU ^^' That's why I changed it to that. Having use_cuda to true by default and then throwing errors if you had no GPU seemed bad...

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