From bd8f163ee60e3ff453af9856df84b46637c646a1 Mon Sep 17 00:00:00 2001
From: hnluo <haoneng.lhn@alibaba-inc.com>
Date: 星期五, 10 二月 2023 11:11:31 +0800
Subject: [PATCH] Merge pull request #91 from alibaba-damo-academy/dev_lyb

---
 funasr/bin/lm_calc_perplexity.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/funasr/bin/lm_calc_perplexity.py b/funasr/bin/lm_calc_perplexity.py
index 27a8a71..198d578 100755
--- a/funasr/bin/lm_calc_perplexity.py
+++ b/funasr/bin/lm_calc_perplexity.py
@@ -56,7 +56,7 @@
     set_all_random_seed(seed)
 
     # 2. Build LM
-    model, train_args = LMTask.build_model_from_file(train_config, model_file, device)
+    model, train_args = LMTask.build_model_from_file(config_file=train_config, model_file=model_file, device=device)
     # Wrape model to make model.nll() data-parallel
     wrapped_model = ForwardAdaptor(model, "nll")
     wrapped_model.to(dtype=getattr(torch, dtype)).eval()
@@ -111,6 +111,7 @@
                     utt_ppl = log_base ** (_nll / ntoken / np.log(log_base))
 
                 # Write PPL of each utts for debugging or analysis
+                writer["utt2nll"][key] = str(-_nll)
                 writer["utt2ppl"][key] = str(utt_ppl)
                 writer["utt2ntokens"][key] = str(ntoken)
 

--
Gitblit v1.9.1