From c59aacf0bee6034636e74d2d208a1fe5cd7d573b Mon Sep 17 00:00:00 2001
From: Yabin Li <wucong.lyb@alibaba-inc.com>
Date: 星期三, 20 三月 2024 19:23:09 +0800
Subject: [PATCH] Update SDK_advanced_guide_offline_en.md
---
funasr/models/transformer/positionwise_feed_forward.py | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/funasr/models/transformer/positionwise_feed_forward.py b/funasr/models/transformer/positionwise_feed_forward.py
index 7ca55cb..081ff5b 100644
--- a/funasr/models/transformer/positionwise_feed_forward.py
+++ b/funasr/models/transformer/positionwise_feed_forward.py
@@ -34,3 +34,16 @@
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