Initial commit: FunASR Speech Recognition Toolkit
Update API Documentation / build-api-docs (push) Has been cancelled

Add complete FunASR codebase including models, runtime, and documentation.
This commit is contained in:
freedakgmail
2026-07-09 22:38:58 +08:00
commit 6116b1f3c6
3683 changed files with 990984 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
import torch
from torch.nn import functional as F
class DotScorer(torch.nn.Module):
def __init__(self):
"""Initialize DotScorer."""
super().__init__()
def forward(
self,
xs_pad: torch.Tensor,
spk_emb: torch.Tensor,
):
# xs_pad: B, T, D
# spk_emb: B, N, D
"""Forward pass for training.
Args:
xs_pad: TODO.
spk_emb: TODO.
"""
scores = torch.matmul(xs_pad, spk_emb.transpose(1, 2))
return scores
class CosScorer(torch.nn.Module):
def __init__(self):
"""Initialize CosScorer."""
super().__init__()
def forward(
self,
xs_pad: torch.Tensor,
spk_emb: torch.Tensor,
):
# xs_pad: B, T, D
# spk_emb: B, N, D
"""Forward pass for training.
Args:
xs_pad: TODO.
spk_emb: TODO.
"""
scores = F.cosine_similarity(xs_pad.unsqueeze(2), spk_emb.unsqueeze(1), dim=-1)
return scores