Skip to content

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

Update rwkv_encoder.py

aky15c7c97cb0fe91
diff --git a/funasr/models/encoder/rwkv_encoder.py b/funasr/models/encoder/rwkv_encoder.py
index 40151bf43..dc1f207be 100644
--- a/funasr/models/encoder/rwkv_encoder.py
+++ b/funasr/models/encoder/rwkv_encoder.py
@@ -113,12 +113,12 @@ class RWKVEncoder(AbsEncoder):
x = self.embed_norm(x)
olens = mask.eq(0).sum(1)
- # for training
- # for block in self.rwkv_blocks:
- # x, _ = block(x)
-
- # for streaming inference
- x = self.rwkv_infer(x)
+ if self.training:
+ for block in self.rwkv_blocks:
+ x, _ = block(x)
+ else:
+ x = self.rwkv_infer(x)
+
x = self.final_norm(x)
if self.time_reduction_factor > 1: