# FunASR vLLM inference The Jev CLI and Python SDK share FunASR’s `AutoModelVLLM` engine. FunASR loads the audio encoder, adaptor and three decision heads from the official checkpoint. vLLM runs the Qwen3.5 text backbone. Both variants support Choice, Noul and Score on complete audio. Tiny also returns one decision per 160 ms step in a file. For incoming waveforms, use a [native live session](streaming.md#receive-waveform-chunks-with-native-vllm). ## Installation Use Linux with one BF16-capable NVIDIA GPU, a compatible CUDA driver and FFmpeg on `PATH`. From the root of the Qwen-Audio-Jev checkout, create a separate Python 3.12 environment for the tested vLLM and Transformers versions. The FunASR pin below contains the Jev engine on `main`. ```sh python3.12 -m venv .venv-vllm . .venv-vllm/bin/activate python -m pip install "vllm==0.19.1" "torch==2.10.0" "torchaudio==2.10.0" \ "transformers==5.5.4" openai-whisper \ "funasr @ git+https://github.com/modelscope/FunASR.git@9d3e62bc052fbcb4121caf80394806eef35622ca" -e . ``` Download a complete [Tiny or base checkpoint](huggingface.md#weight-downloads). The first run prepares a reusable text-backbone cache. Allow about 1.4 GiB of additional space for Tiny or 63.6 GiB for the base model. By default this cache is under `$XDG_CACHE_HOME/funasr/jev-backbone` or `~/.cache/funasr/jev-backbone`. The SDK accepts `backbone_cache_dir` to select a directory outside the checkpoint. ## Command line Set the checkpoint path and visible GPU. These examples use Tiny. For the base model, see the [tested memory settings](#validation-on-one-gpu). ```sh export CUDA_VISIBLE_DEVICES=0 export JEV_CHECKPOINT=/path/to/Qwen-Audio-3.1-Jev-Tiny qwen-audio-jev --backend vllm --input examples/choice.json qwen-audio-jev --backend vllm --batch examples/batch.jsonl --output decisions.jsonl ``` The JSONL command loads the engine once for the batch. Choose a new output path for each run. For per-step decisions on a file, see the [Tiny streaming example](streaming.md#decode-an-audio-file). ## Python SDK Keep one `JevVLLMModel` for successive calls. `infer()` returns one decision and `infer_batch()` returns decisions in input order. `base_dir` resolves relative audio paths in the request objects. ```python import json from pathlib import Path from qwen_audio_jev import JevVLLMModel if __name__ == "__main__": examples = Path("examples") choice = json.loads((examples / "choice.json").read_text()) model = JevVLLMModel() # reads JEV_CHECKPOINT decision = model.infer(choice, base_dir=examples) print(decision["answers"][choice["question_id"]]) requests = [json.loads((examples / name).read_text()) for name in ("noul.json", "score.json")] decisions = model.infer_batch(requests, base_dir=examples) for request, decision in zip(requests, decisions): print(decision["answers"][request["question_id"]]) ``` ## FunASR Python API For the FunASR entry point, pass the same local checkpoint to `AutoModelVLLM`. The optional `jev_base_dir` resolves relative audio paths. FunASR returns one record per request containing its key and the official decision response. See the [FunASR Jev example](https://github.com/modelscope/FunASR/blob/9d3e62bc052fbcb4121caf80394806eef35622ca/examples/qwen_audio_jev/README.md) for the engine configuration. ```python import json import os from pathlib import Path from funasr.auto.auto_model_vllm import AutoModelVLLM if __name__ == "__main__": examples = Path("examples") request = json.loads((examples / "choice.json").read_text()) engine = AutoModelVLLM(model=os.environ["JEV_CHECKPOINT"], max_model_len=2048) rows = engine.generate(inputs=[request], jev_base_dir=examples) print(rows[0]["decision"]["answers"][request["question_id"]]) ``` ## Validation on one GPU On a single GPU with 81,559 MiB of device memory, the FunASR engine ran the official examples with `max_model_len=2048` and `max_num_seqs=2`. The GPU memory fractions were 0.30 for Tiny and 0.88 for base. The tested checkpoint revisions are [Tiny `63057b7`](https://huggingface.co/FunAudioLLM/Qwen-Audio-3.1-Jev-Tiny/tree/63057b786f90c0faf5a98ffaa285e05c9bb76a5d) and [base `b75807f`](https://huggingface.co/FunAudioLLM/Qwen-Audio-3.1-Jev/tree/b75807fcec42050ab711902df7d75e9ecf4c0f95). For the base checkpoint, select it via `JEV_CHECKPOINT` and allow the engine to use the tested GPU memory fraction. ```sh qwen-audio-jev --backend vllm --gpu-memory-utilization 0.88 --batch examples/batch.jsonl --output base-decisions.jsonl ``` In Python, use `JevVLLMModel(os.environ["JEV_CHECKPOINT"], gpu_memory_utilization=0.88, max_num_seqs=2)`. The default `reference` precision mode uses the released model’s accumulation and rounding order inside the vLLM worker. Requests can share a scheduled batch. Each text prefix is evaluated in full, with its own attention and expert reductions. If your CUDA environment forces TF32 via `TORCH_ALLOW_TF32_CUBLAS_OVERRIDE=1`, unset that variable before starting Python. Across the nine published requests, single-request and two-request batches each matched the release reference at all 126 decision positions. The complete decoder inputs, BF16 decision hidden states, three raw logit tensors and final JSON responses matched exactly on the tested GPU. The full model returned 3.61118 for the expected index in the score example. For optimized vLLM attention and fused expert kernels, pass `--vllm-precision native` on the CLI or `jev_precision="native"` in the SDK. This mode shares the reference mode’s checkpoint cache and input format. Its raw logits, probabilities and expected scores can vary with batch formation. Repeated live sessions on the same waveform can also produce different native VAD decisions or SNR levels. Validate thresholds and calibration on representative recordings.