mirror of
https://github.com/pstrueb/piper.git
synced 2026-04-25 09:14:49 +00:00
Add logging
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import logging
|
||||
import json
|
||||
import time
|
||||
import statistics
|
||||
@@ -7,6 +8,8 @@ import sys
|
||||
|
||||
import torch
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser()
|
||||
@@ -15,6 +18,7 @@ def main() -> None:
|
||||
)
|
||||
parser.add_argument("-c", "--config", help="Path to model config file (.json)")
|
||||
args = parser.parse_args()
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
if not args.config:
|
||||
args.config = f"{args.model}.json"
|
||||
@@ -76,8 +80,16 @@ def synthesize(model, phoneme_ids, speaker_id, sample_rate) -> float:
|
||||
|
||||
audio_sec = (len(audio) / 2) / sample_rate
|
||||
infer_sec = (end_time - start_time) / 1e9
|
||||
rtf = infer_sec / audio_sec
|
||||
|
||||
return infer_sec / audio_sec
|
||||
_LOGGER.debug(
|
||||
"Real-time factor: %s (infer=%s sec, audio=%s sec)",
|
||||
rtf,
|
||||
infer_sec,
|
||||
audio_sec,
|
||||
)
|
||||
|
||||
return rtf
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user