Skip to content

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

space between tokens

aky153e333c0abf31
diff --git a/funasr/models_transducer/error_calculator.py b/funasr/models_transducer/error_calculator.py
index 17dbf362f..34b1dc74e 100644
--- a/funasr/models_transducer/error_calculator.py
+++ b/funasr/models_transducer/error_calculator.py
@@ -137,7 +137,6 @@ class ErrorCalculator:
for i, char_pred_i in enumerate(char_pred):
pred = char_pred_i.replace(" ", "")
target = char_target[i].replace(" ", "")
-
distances.append(editdistance.eval(pred, target))
lens.append(len(target))
diff --git a/funasr/models_transducer/espnet_transducer_model_unified.py b/funasr/models_transducer/espnet_transducer_model_unified.py
index efe3f4eb1..6df86f892 100644
--- a/funasr/models_transducer/espnet_transducer_model_unified.py
+++ b/funasr/models_transducer/espnet_transducer_model_unified.py
@@ -455,7 +455,8 @@ class ESPnetASRUnifiedTransducerModel(AbsESPnetModel):
gather=True,
)
- if not self.training and (self.report_cer or self.report_wer):
+ #if not self.training and (self.report_cer or self.report_wer):
+ if self.report_cer or self.report_wer:
if self.error_calculator is None:
self.error_calculator = ErrorCalculator(
self.decoder,
@@ -468,7 +469,6 @@ class ESPnetASRUnifiedTransducerModel(AbsESPnetModel):
)
cer_transducer, wer_transducer = self.error_calculator(encoder_out, target)
-
return loss_transducer, cer_transducer, wer_transducer
return loss_transducer, None, None
diff --git a/funasr/tasks/asr_transducer.py b/funasr/tasks/asr_transducer.py
index 3c7a78261..be1445590 100644
--- a/funasr/tasks/asr_transducer.py
+++ b/funasr/tasks/asr_transducer.py
@@ -137,6 +137,12 @@ class ASRTransducerTask(AbsTask):
default=None,
help="Integer-string mapper for tokens.",
)
+ group.add_argument(
+ "--split_with_space",
+ type=str2bool,
+ default=True,
+ help="whether to split text using <space>",
+ )
group.add_argument(
"--input_size",
type=int_or_none,
@@ -289,6 +295,7 @@ class ASRTransducerTask(AbsTask):
non_linguistic_symbols=args.non_linguistic_symbols,
text_cleaner=args.cleaner,
g2p_type=args.g2p,
+ split_with_space=args.split_with_space if hasattr(args, "split_with_space") else False,
rir_scp=args.rir_scp if hasattr(args, "rir_scp") else None,
rir_apply_prob=args.rir_apply_prob
if hasattr(args, "rir_apply_prob")