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.
This commit is contained in:
tsukumi
2024-09-17 17:56:59 +09:00
parent 5e2c83c6c7
commit b95420325b
4 changed files with 16 additions and 9 deletions

View File

@@ -22,7 +22,6 @@ classifiers = [
"Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: CPython",
] ]
dependencies = [ dependencies = [
"accelerate",
"cmudict", "cmudict",
"cn2an", "cn2an",
"g2p_en", "g2p_en",
@@ -37,10 +36,15 @@ dependencies = [
"pypinyin", "pypinyin",
"pyworld-prebuilt", "pyworld-prebuilt",
"safetensors", "safetensors",
"torch>=2.1",
"transformers", "transformers",
] ]
[project.optional-dependencies]
torch = [
"accelerate",
"torch>=2.1",
]
[project.urls] [project.urls]
Documentation = "https://github.com/litagin02/Style-Bert-VITS2#readme" Documentation = "https://github.com/litagin02/Style-Bert-VITS2#readme"
Issues = "https://github.com/litagin02/Style-Bert-VITS2/issues" Issues = "https://github.com/litagin02/Style-Bert-VITS2/issues"
@@ -68,6 +72,7 @@ packages = ["style_bert_vits2"]
[tool.hatch.envs.test] [tool.hatch.envs.test]
dependencies = ["coverage[toml]>=6.5", "pytest", "scipy"] dependencies = ["coverage[toml]>=6.5", "pytest", "scipy"]
features = ["torch"]
[tool.hatch.envs.test.scripts] [tool.hatch.envs.test.scripts]
# Usage: `hatch run test:test` # Usage: `hatch run test:test`
test = "pytest {args:tests}" test = "pytest {args:tests}"
@@ -77,6 +82,8 @@ test-cov = "coverage run -m pytest {args:tests}"
cov-report = ["- coverage combine", "coverage report"] cov-report = ["- coverage combine", "coverage report"]
# Usage: `hatch run test:cov` # Usage: `hatch run test:cov`
cov = ["test-cov", "cov-report"] cov = ["test-cov", "cov-report"]
[[tool.hatch.envs.test.matrix]]
python = ["3.9", "3.10", "3.11"]
[tool.hatch.envs.style] [tool.hatch.envs.style]
detached = true detached = true
@@ -94,9 +101,6 @@ fmt = [
"check", "check",
] ]
[[tool.hatch.envs.test.matrix]]
python = ["3.9", "3.10", "3.11"]
[tool.coverage.run] [tool.coverage.run]
source_pkgs = ["style_bert_vits2", "tests"] source_pkgs = ["style_bert_vits2", "tests"]
branch = true branch = true

View File

@@ -9,6 +9,7 @@ loguru
num2words num2words
numpy<2 numpy<2
onnxruntime onnxruntime
onnxruntime-gpu
pyannote.audio>=3.1.0 pyannote.audio>=3.1.0
pyloudnorm pyloudnorm
pyopenjtalk-dict pyopenjtalk-dict

View File

@@ -11,6 +11,7 @@ loguru
num2words num2words
numpy<2 numpy<2
onnxruntime onnxruntime
onnxruntime-gpu
# onnxsim # onnxsim
# protobuf==4.25 # protobuf==4.25
psutil psutil
@@ -22,7 +23,7 @@ pypinyin
pyworld-prebuilt pyworld-prebuilt
# stable_ts # stable_ts
# tensorboard # tensorboard
torch<2.4 torch
torchaudio<2.4 torchaudio
transformers transformers
umap-learn umap-learn

View File

@@ -11,6 +11,7 @@ loguru
num2words num2words
numpy<2 numpy<2
onnxruntime onnxruntime
onnxruntime-gpu
onnxsim onnxsim
protobuf==4.25 protobuf==4.25
psutil psutil
@@ -22,7 +23,7 @@ pypinyin
pyworld-prebuilt pyworld-prebuilt
stable_ts stable_ts
tensorboard tensorboard
torch<2.4 torch
torchaudio<2.4 torchaudio
transformers transformers
umap-learn umap-learn