From 33d3d2084403fd34b79c835d2f2fe04f6cd8f738 Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期三, 13 九月 2023 09:33:54 +0800
Subject: [PATCH] Merge branch 'main' of github.com:alibaba-damo-academy/FunASR add
---
funasr/models/e2e_asr_transducer.py | 32 ++------------------------------
1 files changed, 2 insertions(+), 30 deletions(-)
diff --git a/funasr/models/e2e_asr_transducer.py b/funasr/models/e2e_asr_transducer.py
index 4e33bd6..bffd54d 100644
--- a/funasr/models/e2e_asr_transducer.py
+++ b/funasr/models/e2e_asr_transducer.py
@@ -6,7 +6,6 @@
import torch
from packaging.version import parse as V
-from typeguard import check_argument_types
from funasr.losses.label_smoothing_loss import (
LabelSmoothingLoss, # noqa: H301
)
@@ -85,8 +84,6 @@
) -> None:
"""Construct an ESPnetASRTransducerModel object."""
super().__init__()
-
- assert check_argument_types()
# The following labels ID are reserved: 0 (blank) and vocab_size - 1 (sos/eos)
self.blank_id = 0
@@ -356,11 +353,6 @@
"""
if self.criterion_transducer is None:
try:
- # from warprnnt_pytorch import RNNTLoss
- # self.criterion_transducer = RNNTLoss(
- # reduction="mean",
- # fastemit_lambda=self.fastemit_lambda,
- # )
from warp_rnnt import rnnt_loss as RNNTLoss
self.criterion_transducer = RNNTLoss
@@ -371,12 +363,6 @@
)
exit(1)
- # loss_transducer = self.criterion_transducer(
- # joint_out,
- # target,
- # t_len,
- # u_len,
- # )
log_probs = torch.log_softmax(joint_out, dim=-1)
loss_transducer = self.criterion_transducer(
@@ -546,8 +532,6 @@
"""Construct an ESPnetASRTransducerModel object."""
super().__init__()
- assert check_argument_types()
-
# The following labels ID are reserved: 0 (blank) and vocab_size - 1 (sos/eos)
self.blank_id = 0
@@ -642,7 +626,6 @@
batch_size = speech.shape[0]
text = text[:, : text_lengths.max()]
- #print(speech.shape)
# 1. Encoder
encoder_out, encoder_out_chunk, encoder_out_lens = self.encode(speech, speech_lengths)
@@ -713,8 +696,8 @@
loss_lm = self._calc_lm_loss(decoder_out, target)
loss_trans = loss_trans_utt + loss_trans_chunk
- loss_ctc = loss_ctc + loss_ctc_chunk
- loss_ctc = loss_att + loss_att_chunk
+ loss_ctc = loss_ctc + loss_ctc_chunk
+ loss_att = loss_att + loss_att_chunk
loss = (
self.transducer_weight * loss_trans
@@ -859,11 +842,6 @@
"""
if self.criterion_transducer is None:
try:
- # from warprnnt_pytorch import RNNTLoss
- # self.criterion_transducer = RNNTLoss(
- # reduction="mean",
- # fastemit_lambda=self.fastemit_lambda,
- # )
from warp_rnnt import rnnt_loss as RNNTLoss
self.criterion_transducer = RNNTLoss
@@ -874,12 +852,6 @@
)
exit(1)
- # loss_transducer = self.criterion_transducer(
- # joint_out,
- # target,
- # t_len,
- # u_len,
- # )
log_probs = torch.log_softmax(joint_out, dim=-1)
loss_transducer = self.criterion_transducer(
--
Gitblit v1.9.1