CoolFace
Apppublic

everythingfades/vits_personal_exploration

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
__init__.py21 linesDownload Raw Back to monotonic_align
1from numpy import zeros, int32, float322from torch import from_numpy3 4from .core import maximum_path_jit5 6 7def maximum_path(neg_cent, mask):8    """ numba optimized version.9    neg_cent: [b, t_t, t_s]10    mask: [b, t_t, t_s]11    """12    device = neg_cent.device13    dtype = neg_cent.dtype14    neg_cent = neg_cent.data.cpu().numpy().astype(float32)15    path = zeros(neg_cent.shape, dtype=int32)16 17    t_t_max = mask.sum(1)[:, 0].data.cpu().numpy().astype(int32)18    t_s_max = mask.sum(2)[:, 0].data.cpu().numpy().astype(int32)19    maximum_path_jit(path, neg_cent, t_t_max, t_s_max)20    return from_numpy(path).to(device=device, dtype=dtype)21