forked from yl4579/StyleTTS2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request yl4579#13 from fumiama/mono
feat: drop cython monotonic_align
- Loading branch information
Showing
9 changed files
with
54 additions
and
26,600 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
import numpy as np | ||
import torch | ||
from .monotonic_align.core import maximum_path_c | ||
|
||
|
||
def maximum_path(neg_cent, mask): | ||
""" Cython optimized version. | ||
neg_cent: [b, t_t, t_s] | ||
mask: [b, t_t, t_s] | ||
""" | ||
device = neg_cent.device | ||
dtype = neg_cent.dtype | ||
neg_cent = neg_cent.data.cpu().numpy().astype(np.float32) | ||
path = np.zeros(neg_cent.shape, dtype=np.int32) | ||
|
||
t_t_max = mask.sum(1)[:, 0].data.cpu().numpy().astype(np.int32) | ||
t_s_max = mask.sum(2)[:, 0].data.cpu().numpy().astype(np.int32) | ||
maximum_path_c(path, neg_cent, t_t_max, t_s_max) | ||
return torch.from_numpy(path).to(device=device, dtype=dtype) | ||
from numpy import zeros, int32, float32 | ||
from torch import from_numpy | ||
|
||
from .core import maximum_path_jit | ||
|
||
def maximum_path(neg_cent, mask): | ||
device = neg_cent.device | ||
dtype = neg_cent.dtype | ||
neg_cent = neg_cent.data.cpu().numpy().astype(float32) | ||
path = zeros(neg_cent.shape, dtype=int32) | ||
|
||
t_t_max = mask.sum(1)[:, 0].data.cpu().numpy().astype(int32) | ||
t_s_max = mask.sum(2)[:, 0].data.cpu().numpy().astype(int32) | ||
maximum_path_jit(path, neg_cent, t_t_max, t_s_max) | ||
return from_numpy(path).to(device=device, dtype=dtype) |
Oops, something went wrong.