add time print for each loop step

This commit is contained in:
2025-03-24 20:34:34 +00:00
parent 7e97db55a0
commit cb632d3eb9
2 changed files with 8 additions and 54 deletions

52
poetry.lock generated
View File

@@ -230,18 +230,6 @@ files = [
[package.extras]
dev = ["backports.zoneinfo ; python_version < \"3.9\"", "freezegun (>=1.0,<2.0)", "jinja2 (>=3.0)", "pytest (>=6.0)", "pytest-cov", "pytz", "setuptools", "tzdata ; sys_platform == \"win32\""]
[[package]]
name = "blinker"
version = "1.9.0"
description = "Fast, simple object-to-object and broadcast signaling"
optional = false
python-versions = ">=3.9"
groups = ["main"]
files = [
{file = "blinker-1.9.0-py3-none-any.whl", hash = "sha256:ba0efaa9080b619ff2f3459d1d500c57bddea4a6b424b60a91141db6fd2f08bc"},
{file = "blinker-1.9.0.tar.gz", hash = "sha256:b4ce2265a7abece45e7cc896e98dbebe6cead56bcf805a3d23136d145f5445bf"},
]
[[package]]
name = "blis"
version = "0.7.11"
@@ -752,7 +740,6 @@ coqui-tts-trainer = ">=0.2.0,<0.3.0"
cython = ">=3.0.0"
einops = ">=0.6.0"
encodec = ">=0.1.1"
flask = {version = ">=3.0.0", optional = true, markers = "extra == \"server\""}
fsspec = {version = ">=2023.6.0", extras = ["http"]}
gruut = {version = ">=2.4.0", extras = ["de", "es", "fr"]}
inflect = ">=5.6.0"
@@ -803,7 +790,6 @@ coqui-tts-trainer = ">=0.2.0,<0.3.0"
cython = ">=3.0.0"
einops = ">=0.6.0"
encodec = ">=0.1.1"
flask = {version = ">=3.0.0", optional = true, markers = "extra == \"server\""}
fsspec = {version = ">=2023.6.0", extras = ["http"]}
gruut = {version = ">=2.4.0", extras = ["de", "es", "fr"]}
inflect = ">=5.6.0"
@@ -1111,30 +1097,6 @@ docs = ["furo (>=2024.8.6)", "sphinx (>=8.1.3)", "sphinx-autodoc-typehints (>=3)
testing = ["covdefaults (>=2.3)", "coverage (>=7.6.10)", "diff-cover (>=9.2.1)", "pytest (>=8.3.4)", "pytest-asyncio (>=0.25.2)", "pytest-cov (>=6)", "pytest-mock (>=3.14)", "pytest-timeout (>=2.3.1)", "virtualenv (>=20.28.1)"]
typing = ["typing-extensions (>=4.12.2) ; python_version < \"3.11\""]
[[package]]
name = "flask"
version = "3.1.0"
description = "A simple framework for building complex web applications."
optional = false
python-versions = ">=3.9"
groups = ["main"]
files = [
{file = "flask-3.1.0-py3-none-any.whl", hash = "sha256:d667207822eb83f1c4b50949b1623c8fc8d51f2341d65f72e1a1815397551136"},
{file = "flask-3.1.0.tar.gz", hash = "sha256:5f873c5184c897c8d9d1b05df1e3d01b14910ce69607a117bd3277098a5836ac"},
]
[package.dependencies]
blinker = ">=1.9"
click = ">=8.1.3"
importlib-metadata = {version = ">=3.6", markers = "python_version < \"3.10\""}
itsdangerous = ">=2.2"
Jinja2 = ">=3.1.2"
Werkzeug = ">=3.1"
[package.extras]
async = ["asgiref (>=3.2)"]
dotenv = ["python-dotenv"]
[[package]]
name = "fonttools"
version = "4.56.0"
@@ -1641,18 +1603,6 @@ enabler = ["pytest-enabler (>=2.2)"]
test = ["pygments", "pytest (>=6,!=8.1.*)"]
type = ["pytest-mypy"]
[[package]]
name = "itsdangerous"
version = "2.2.0"
description = "Safely pass data to untrusted environments and back."
optional = false
python-versions = ">=3.8"
groups = ["main"]
files = [
{file = "itsdangerous-2.2.0-py3-none-any.whl", hash = "sha256:c6242fc49e35958c8b15141343aa660db5fc54d4f13a1db01a3f5891b98700ef"},
{file = "itsdangerous-2.2.0.tar.gz", hash = "sha256:e0050c0b7da1eea53ffaf149c0cfbb5c6e2e2b69c4bef22c81fa6eb73e5f6173"},
]
[[package]]
name = "jinja2"
version = "3.1.6"
@@ -5351,4 +5301,4 @@ type = ["pytest-mypy"]
[metadata]
lock-version = "2.1"
python-versions = ">=3.9.0, <3.12"
content-hash = "d481879db7e84cbcfef78e7f6e832087f051ed74dde2263cba1c86e958194bc0"
content-hash = "ee701530da0d8840e30fe07acbf372b4aec14e688bebf20ec5bd5eaa96270073"

View File

@@ -4,6 +4,7 @@ from TTS.api import TTS
# Get device
if torch.cuda.is_available():
print('Running on gpu')
device = "cuda"
else:
print('Running on cpu')
@@ -46,16 +47,19 @@ for idx, speaker in enumerate(tts.speakers, 1):
safe_name = speaker.replace(" ", "_").replace("/", "-")
filename = f"output_wav/{safe_name}.wav"
# Generate audio
# Generate audio with timing
step_start = time.time()
tts.tts_to_file(
text="Bitte beachten Sie: Sicherheitscheck 5 ist jetzt geöffnet. Bitte warten Sie im bereitgestellten Wartebereich, bis Sie aufgerufen werden.",
speaker=speaker,
language="de",
file_path=filename
)
step_end = time.time()
# Print progress
progress = f"[{idx}/{total_speakers}] {filename}"
# Print progress with duration
step_duration = step_end - step_start
progress = f"[{idx}/{total_speakers}] {filename} - {step_duration:.2f}s"
print(progress)
end_gen = time.time()
print(f"Generation time: {end_gen - start_gen:.2f} seconds")