Skip to content

Commit

Permalink
style: make style && make lint
Browse files Browse the repository at this point in the history
  • Loading branch information
eginhard committed Mar 6, 2024
1 parent 4e183c6 commit 017c84d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions TTS/tts/datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import random
from typing import Dict, List, Union

import mutagen
import numpy as np
import torch
import tqdm
Expand All @@ -13,8 +14,6 @@
from TTS.utils.audio import AudioProcessor
from TTS.utils.audio.numpy_transforms import compute_energy as calculate_energy

import mutagen

# to prevent too many open files error as suggested here
# https://github.com/pytorch/pytorch/issues/11201#issuecomment-421146936
torch.multiprocessing.set_sharing_strategy("file_system")
Expand Down Expand Up @@ -47,7 +46,9 @@ def string2filename(string):
def get_audio_size(audiopath):
extension = audiopath.rpartition(".")[-1].lower()
if extension not in {"mp3", "wav", "flac"}:
raise RuntimeError(f"The audio format {extension} is not supported, please convert the audio files to mp3, flac, or wav format!")
raise RuntimeError(
f"The audio format {extension} is not supported, please convert the audio files to mp3, flac, or wav format!"
)

audio_info = mutagen.File(audiopath).info
return int(audio_info.length * audio_info.sample_rate)
Expand Down

0 comments on commit 017c84d

Please sign in to comment.