Use logger instead of print

This commit is contained in:
litagin02
2024-01-06 13:59:10 +09:00
parent 432689e29f
commit 100949d970
6 changed files with 24 additions and 19 deletions

View File

@@ -7,8 +7,9 @@ import torch
from tqdm import tqdm
import utils
from config import config
from common.log import logger
from common.stdout_wrapper import SAFE_STDOUT
from config import config
warnings.filterwarnings("ignore", category=UserWarning)
from pyannote.audio import Inference, Model
@@ -23,8 +24,7 @@ def save_style_vector(wav_path):
try:
style_vec = inference(wav_path)
except Exception as e:
print(f"\nError occurred with file: {wav_path}")
print(e)
logger.error(f"\nError occurred with file: {wav_path}, Details:\n{e}\n")
raise
np.save(f"{wav_path}.npy", style_vec) # `test.wav` -> `test.wav.npy`
return style_vec
@@ -69,4 +69,4 @@ if __name__ == "__main__":
)
)
print(f"Finished generating style vectors! total: {len(wavnames)} npy files.")
logger.info(f"Finished generating style vectors! total: {len(wavnames)} npy files.")