mirror of https://github.com/coqui-ai/TTS.git
Check num of columns in coqui format (#2066)
* Check 4 colums in coqui format * Fix encoding * Fixup
This commit is contained in:
parent
f3b947e706
commit
843fa6f3fa
|
@ -15,6 +15,15 @@ from tqdm import tqdm
|
|||
|
||||
def coqui(root_path, meta_file, ignored_speakers=None):
|
||||
"""Interal dataset formatter."""
|
||||
filepath = os.path.join(root_path, meta_file)
|
||||
# ensure there are 4 columns for every line
|
||||
with open(filepath, "r", encoding="utf8") as f:
|
||||
lines = f.readlines()
|
||||
num_cols = len(lines[0].split("|")) # take the first row as reference
|
||||
for idx, line in enumerate(lines[1:]):
|
||||
if len(line.split("|")) != num_cols:
|
||||
print(f" > Missing column in line {idx + 1} -> {line.strip()}")
|
||||
# load metadata
|
||||
metadata = pd.read_csv(os.path.join(root_path, meta_file), sep="|")
|
||||
assert all(x in metadata.columns for x in ["audio_file", "text"])
|
||||
speaker_name = None if "speaker_name" in metadata.columns else "coqui"
|
||||
|
|
Loading…
Reference in New Issue