Skip to content

SentencePiece postprocessing returns different casing for the transcript and word list #3997

Done

Description

@dongyikuan919

Bug

The SentencePiece postprocessor returns different casing for the same word in its transcript and word list. For example, it returns i have a test and ["I", "have", "a", "test"] together. This also affects I'm, I've, and I'll.

To reproduce

From a FunASR checkout at f95fe7904ec81157b1cf13a63bf4553f6725cd22, run the following. It loads the two standalone postprocessors directly.

python - <<'PY'
from runpy import run_path

for path in (
    "funasr/utils/postprocess_utils.py",
    "runtime/python/onnxruntime/funasr_onnx/utils/postprocess_utils.py",
):
    process = run_path(path)["sentence_postprocess_sentencepiece"]
    print(process(["▁i", "▁have", "▁a", "▁test"]))
PY

Both print ('i have a test', ['I', 'have', 'a', 'test']).

Expected behavior

Both outputs should use the same already-normalized casing: ('I have a test', ['I', 'have', 'a', 'test']). ONNX Paraformer exposes both values for English BPE and the HTTP example returns the transcript value.

Environment

macOS 15.0 (arm64), Python 3.12.10. Reproduced on the source checkout and directly from the published funasr==1.4.29 and funasr-onnx==0.4.11 wheels. The sample uses decoded pieces and needs neither audio nor model weights.

Activity

  1. LauraGPT commented on Dec 1, 2026

    @LauraGPT
    Collaborator

    I reproduced the casing mismatch in both Python and ONNX postprocessing on the parent revision: the four pronoun/contraction cases failed, while the two unchanged-word controls passed. At the proposed head all 82 text-postprocessing workflow tests passed in the isolated CPU environment. Tested PR #3998 at ac85bd33570b. This is a postprocessing test on decoded inputs, not an ASR accuracy measurement or a published package fix.

  2. LauraGPT commented on Dec 1, 2026

    @LauraGPT
    Collaborator

    The fix is now on FunASR main at ece409bd. Both Python and ONNX postprocessors return I have a test and the matching word list for your example. The merged CI wheel and source archive both contain the corrected module. I also reproduced the corrected output from a private offline installation of that candidate wheel. Its internal version is still 0.4.11; this did not replace the existing PyPI package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions