From b95420325bff9f654e3c4dfe0c7bc53638aa584e Mon Sep 17 00:00:00 2001 From: tsukumi Date: Tue, 17 Sep 2024 17:56:59 +0900 Subject: [PATCH] Improve: Changed PyTorch to an optional dependency when used style_bert_vits2 as a library ONNXRuntime has relied on CUDA 12.x / cuDNN 9.x by default since v1.19.0, while PyTorch finally supports cuDNN 9 since v2.4.0. Therefore, unless the pinning of torch<2.4 is eliminated, CUDA cannot be used with the latest version of ONNXRuntime. --- pyproject.toml | 14 +++++++++----- requirements-colab.txt | 1 + requirements-infer.txt | 5 +++-- requirements.txt | 5 +++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e16913f..ed6f6dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,6 @@ classifiers = [ "Programming Language :: Python :: Implementation :: CPython", ] dependencies = [ - "accelerate", "cmudict", "cn2an", "g2p_en", @@ -37,10 +36,15 @@ dependencies = [ "pypinyin", "pyworld-prebuilt", "safetensors", - "torch>=2.1", "transformers", ] +[project.optional-dependencies] +torch = [ + "accelerate", + "torch>=2.1", +] + [project.urls] Documentation = "https://github.com/litagin02/Style-Bert-VITS2#readme" Issues = "https://github.com/litagin02/Style-Bert-VITS2/issues" @@ -68,6 +72,7 @@ packages = ["style_bert_vits2"] [tool.hatch.envs.test] dependencies = ["coverage[toml]>=6.5", "pytest", "scipy"] +features = ["torch"] [tool.hatch.envs.test.scripts] # Usage: `hatch run test:test` test = "pytest {args:tests}" @@ -77,6 +82,8 @@ test-cov = "coverage run -m pytest {args:tests}" cov-report = ["- coverage combine", "coverage report"] # Usage: `hatch run test:cov` cov = ["test-cov", "cov-report"] +[[tool.hatch.envs.test.matrix]] +python = ["3.9", "3.10", "3.11"] [tool.hatch.envs.style] detached = true @@ -94,9 +101,6 @@ fmt = [ "check", ] -[[tool.hatch.envs.test.matrix]] -python = ["3.9", "3.10", "3.11"] - [tool.coverage.run] source_pkgs = ["style_bert_vits2", "tests"] branch = true diff --git a/requirements-colab.txt b/requirements-colab.txt index 39ac92b..7199118 100644 --- a/requirements-colab.txt +++ b/requirements-colab.txt @@ -9,6 +9,7 @@ loguru num2words numpy<2 onnxruntime +onnxruntime-gpu pyannote.audio>=3.1.0 pyloudnorm pyopenjtalk-dict diff --git a/requirements-infer.txt b/requirements-infer.txt index dcb9f7e..30ced75 100644 --- a/requirements-infer.txt +++ b/requirements-infer.txt @@ -11,6 +11,7 @@ loguru num2words numpy<2 onnxruntime +onnxruntime-gpu # onnxsim # protobuf==4.25 psutil @@ -22,7 +23,7 @@ pypinyin pyworld-prebuilt # stable_ts # tensorboard -torch<2.4 -torchaudio<2.4 +torch +torchaudio transformers umap-learn diff --git a/requirements.txt b/requirements.txt index f9fc982..4e0a084 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,6 +11,7 @@ loguru num2words numpy<2 onnxruntime +onnxruntime-gpu onnxsim protobuf==4.25 psutil @@ -22,7 +23,7 @@ pypinyin pyworld-prebuilt stable_ts tensorboard -torch<2.4 -torchaudio<2.4 +torch +torchaudio transformers umap-learn