From 1cdb3cc28d4d89a576cc06e5cd8eb80da1f3a3aa Mon Sep 17 00:00:00 2001
From: zhifu gao <zhifu.gzf@alibaba-inc.com>
Date: 星期五, 26 四月 2024 11:27:39 +0800
Subject: [PATCH] Dev gzf exp (#1665)

---
 funasr/models/sense_voice/model.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/funasr/models/sense_voice/model.py b/funasr/models/sense_voice/model.py
index b731bb6..07fb4eb 100644
--- a/funasr/models/sense_voice/model.py
+++ b/funasr/models/sense_voice/model.py
@@ -309,7 +309,7 @@
         if len(speech_lengths.size()) > 1:
             speech_lengths = speech_lengths[:, 0]
 
-        batch_size = speech.shape[0]
+        batch_size, frames, _ = speech.shape
 
         if self.activation_checkpoint:
             from torch.utils.checkpoint import checkpoint
@@ -328,6 +328,7 @@
         stats["acc"] = acc_att
         stats["loss"] = torch.clone(loss.detach())
         stats["batch_size"] = batch_size
+        stats["batch_size_x_frames"] = frames * batch_size
 
         # force_gatherable: to-device and to-tensor if scalar for DataParallel
         if self.length_normalized_loss:

--
Gitblit v1.9.1