Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add pc-ddsp, bigvgan and refactor a lot #340

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ repos:
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
args: [-w]
#- repo: https://github.com/codespell-project/codespell
# rev: v2.2.4
# hooks:
# - id: codespell
# args: [-w]
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
Expand Down
33 changes: 33 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
MIT License

Copyright (c) 2023 34j and contributors
Copyright (c) 2022 NVIDIA CORPORATION.
Copyright (c) 2020 Edward Dixon
Copyright 2020 Alexandre Défossez
Copyright (c) 2023 yxlllc
Copyright (c) 2021 Jingyi Li

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -221,3 +225,32 @@ SOFTWARE.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
BSD 3-Clause License

Copyright (c) 2019, Seungwon Park 박승원
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
72 changes: 71 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ myst-parser = ">=0.16"
sphinx = ">=4.0"
sphinx-rtd-theme = ">=1.0"


[tool.poetry.group.pc_ddsp.dependencies]
gin = "^0.1.6"
gin-config = "^0.5.0"
local-attention = "^1.8.5"


[tool.poetry.group.bigvgan.dependencies]
alias-free-torch = "^0.0.6"

[tool.semantic_release]
branch = "main"
version_toml = "pyproject.toml:tool.poetry.version"
Expand Down
15 changes: 3 additions & 12 deletions src/so_vits_svc_fork/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _pad_stack(array: Sequence[torch.Tensor]) -> torch.Tensor:
class TextAudioCollate(nn.Module):
def forward(
self, batch: Sequence[dict[str, torch.Tensor]]
) -> tuple[torch.Tensor, ...]:
) -> dict[str, torch.Tensor]:
batch = [b for b in batch if b is not None]
batch = list(sorted(batch, key=lambda x: x["mel_spec"].shape[1], reverse=True))
lengths = torch.tensor([b["mel_spec"].shape[1] for b in batch]).long()
Expand All @@ -74,14 +74,5 @@ def forward(
results[key] = _pad_stack([b[key] for b in batch]).cpu()
else:
results[key] = torch.tensor([[b[key]] for b in batch]).cpu()

return (
results["content"],
results["f0"],
results["spec"],
results["mel_spec"],
results["audio"],
results["spk"],
lengths,
results["uv"],
)
results["length"] = lengths
return results
6 changes: 3 additions & 3 deletions src/so_vits_svc_fork/f0.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
import torchcrepe
from cm_time import timer
from numpy import dtype, float32, ndarray
from torch import FloatTensor, Tensor
from torch import Tensor

from so_vits_svc_fork.utils import get_optimal_device

LOG = getLogger(__name__)


def normalize_f0(
f0: FloatTensor, x_mask: FloatTensor, uv: FloatTensor, random_scale=True
) -> FloatTensor:
f0: Tensor, x_mask: Tensor, uv: Tensor, random_scale: bool = True
) -> Tensor:
# calculate means based on x_mask
uv_sum = torch.sum(uv, dim=1, keepdim=True)
uv_sum[uv_sum == 0] = 9999
Expand Down
4 changes: 2 additions & 2 deletions src/so_vits_svc_fork/inference/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ def infer(
audio = self.net_g.infer(
c,
f0=f0,
g=sid,
spk=sid,
uv=uv,
predict_f0=auto_predict_f0,
noice_scale=noise_scale,
noise_scale=noise_scale,
)[0, 0].data.float()
audio_duration = audio.shape[-1] / self.target_sample
LOG.info(
Expand Down
Loading