mirror of https://github.com/coqui-ai/TTS.git
Make style
This commit is contained in:
parent
9f1670010b
commit
39f31e3d39
|
@ -1,14 +1,14 @@
|
|||
import argparse
|
||||
import os
|
||||
from argparse import RawTextHelpFormatter
|
||||
import torch
|
||||
|
||||
import torch
|
||||
from tqdm import tqdm
|
||||
|
||||
from TTS.config import load_config
|
||||
from TTS.tts.datasets import load_tts_samples
|
||||
from TTS.tts.utils.speakers import SpeakerManager
|
||||
from TTS.tts.utils.managers import save_file
|
||||
from TTS.tts.utils.speakers import SpeakerManager
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="""Compute embedding vectors for each wav file in a dataset.\n\n"""
|
||||
|
|
|
@ -11,7 +11,7 @@ from TTS.encoder.utils.generic_utils import setup_encoder_model
|
|||
from TTS.utils.audio import AudioProcessor
|
||||
|
||||
|
||||
def load_file(path:str):
|
||||
def load_file(path: str):
|
||||
if path.endswith(".json"):
|
||||
with fsspec.open(path, "r") as f:
|
||||
return json.load(f)
|
||||
|
@ -22,7 +22,7 @@ def load_file(path:str):
|
|||
raise ValueError("Unsupported file type")
|
||||
|
||||
|
||||
def save_file(obj: Any, path:str):
|
||||
def save_file(obj: Any, path: str):
|
||||
if path.endswith(".json"):
|
||||
with fsspec.open(path, "w") as f:
|
||||
json.dump(obj, f, indent=4)
|
||||
|
@ -32,6 +32,7 @@ def save_file(obj: Any, path:str):
|
|||
else:
|
||||
raise ValueError("Unsupported file type")
|
||||
|
||||
|
||||
class BaseIDManager:
|
||||
"""Base `ID` Manager class. Every new `ID` manager must inherit this.
|
||||
It defines common `ID` manager specific functions.
|
||||
|
@ -146,7 +147,7 @@ class EmbeddingManager(BaseIDManager):
|
|||
Args:
|
||||
file_path (str): Path to the output file.
|
||||
"""
|
||||
save_file(self.embeddings, file_path)
|
||||
save_file(self.embeddings, file_path)
|
||||
|
||||
def load_embeddings_from_file(self, file_path: str) -> None:
|
||||
"""Load embeddings from a json file.
|
||||
|
|
Loading…
Reference in New Issue