Skip to content

Moonshine ASR pipeline throws 'Unable to decode without a tokenizer' — _call_moonshine calls processor.batch_decode but processor has no tokenizer #1735

Description

@mosabsayyed

Bug

The automatic-speech-recognition pipeline crashes at decode time for all moonshine models (e.g. onnx-community/moonshine-tiny-ar-ONNX, onnx-community/moonshine-tiny-en-ONNX), in both 3.8.1 and 4.2.0.

Exact error

Error: Unable to decode without a tokenizer.
    at Function.batch_decode (transformers.node.mjs:15763)
    at Function._call_moonshine (transformers.node.mjs:32216)

Reproduce (Node, v4.2.0)

import { pipeline, env } from "@huggingface/transformers";
env.allowLocalModels = false;
const transcriber = await pipeline("automatic-speech-recognition", "onnx-community/moonshine-tiny-ar-ONNX", { dtype: "q8", device: "cpu" });
// model loads fine (~3s)
const out = await transcriber(float32Audio16k); // throws at decode

Root cause

_call_moonshine calls the processor's batch_decode:

// src/pipelines/automatic-speech-recognition.js:328 (v4.2.0)
const text = this.processor.batch_decode(outputs, { skip_special_tokens: true })[0];

But the moonshine processor is constructed without a tokenizer — only a feature_extractor. Verified directly:

const proc = await AutoProcessor.from_pretrained("onnx-community/moonshine-tiny-ar-ONNX");
// proc.components => ['feature_extractor']   (no 'tokenizer')
// proc.config.processor_class => undefined
// proc.config.auto_map => undefined

So processor.batch_decode hits its if (!this.tokenizer) throw guard (processing_utils.js:94).

The pipeline-level tokenizer is correctly populated:

const p = await pipeline("automatic-speech-recognition", "onnx-community/moonshine-tiny-ar-ONNX", {...});
// p.tokenizer => PreTrainedTokenizer  (loaded from tokenizer.json) ✓
// p.processor.tokenizer => undefined   ✗

Fix

_call_moonshine should use the pipeline's tokenizer, not the processor's:

const text = this.tokenizer.batch_decode(outputs, { skip_special_tokens: true })[0];

This matches every other ASR path — _call_whisper uses this.tokenizer._decode_asr, and _call_wav2vec2 uses this.tokenizer.decode. _call_moonshine is the only one that routes through this.processor, and the processor legitimately may not carry a tokenizer.

Environment

  • @huggingface/transformers: 3.8.1 (reproduced) and 4.2.0 (reproduced)
  • Model: onnx-community/moonshine-tiny-ar-ONNX (and the en variant)
  • Runtime: Node 22 (onnxruntime-node cpu) and browser (onnxruntime-web wasm)

Thank you.

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