From 93a02feda1848531a48a1794a8de12a962c84a8e Mon Sep 17 00:00:00 2001
From: Xingchen Song(宋星辰) <xingchensong1996@163.com>
Date: 星期五, 07 六月 2024 23:10:13 +0800
Subject: [PATCH] [fix] fix empty asr result (#1794)
---
funasr/models/transformer/positionwise_feed_forward.py | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/funasr/models/transformer/positionwise_feed_forward.py b/funasr/models/transformer/positionwise_feed_forward.py
index 7ca55cb..7cfa5f9 100644
--- a/funasr/models/transformer/positionwise_feed_forward.py
+++ b/funasr/models/transformer/positionwise_feed_forward.py
@@ -34,3 +34,15 @@
return self.w_2(self.dropout(self.activation(self.w_1(x))))
+class PositionwiseFeedForwardDecoderSANMExport(torch.nn.Module):
+ def __init__(self, model):
+ super().__init__()
+ self.w_1 = model.w_1
+ self.w_2 = model.w_2
+ self.activation = model.activation
+ self.norm = model.norm
+
+ def forward(self, x):
+ x = self.activation(self.w_1(x))
+ x = self.w_2(self.norm(x))
+ return x
--
Gitblit v1.9.1