# HF Models and Loading `JevForAudioDecision` extends Hugging Face `PreTrainedModel`. It includes an audio encoder, an adaptor, a native Qwen3.5 backbone from Transformers 5.3.0, and the Choice, Noul, and Score decision heads. Qwen-Audio-3.1-Jev uses a mixture-of-experts (MoE) language model, while Qwen-Audio-3.1-Jev-Tiny uses a dense language model. `JevProcessor` prepares the audio and question, and the model returns logits for the three decision heads. ## Weight Downloads | Variant | Weights | | --- | --- | | Qwen-Audio-3.1-Jev | [FunAudioLLM/Qwen-Audio-3.1-Jev](https://huggingface.co/FunAudioLLM/Qwen-Audio-3.1-Jev) | | Qwen-Audio-3.1-Jev-Tiny | [FunAudioLLM/Qwen-Audio-3.1-Jev-Tiny](https://huggingface.co/FunAudioLLM/Qwen-Audio-3.1-Jev-Tiny) | The FunASR vLLM backend reads these same checkpoints. Download the complete directory for your chosen variant, then follow the [vLLM installation and examples](vllm.md). ### Checkpoint Directory Both variants use a complete HF Jev directory with `config.json`, tokenizer files, and `mel_filters.npz`. Weights can be stored in a single `model.safetensors` file or in shards listed in `model.safetensors.index.json`. If the model publisher includes `HF_EXPORT_COMPLETE.json`, the CLI verifies file sizes and SHA256 checksums against it. Both variants use decision-only checkpoints containing the audio encoder, adaptor, language decoder, and Choice / Noul / Score heads. AR text output weights (`lm_head` / `output_layer`) are excluded. The loader does not create replacement AR heads, and no `ar_head_removed` configuration flag is required. Loading with standard `AutoModel` requires the model and configuration code referenced by `auto_map` in the checkpoint. Loading with the repository's `JevForAudioDecision` uses the model implementation from this checkout. ### Load Qwen-Audio-3.1-Jev or Qwen-Audio-3.1-Jev-Tiny Point `--checkpoint` to the appropriate checkpoint directory. Use `--variant` to check that the checkpoint matches the requested variant. You can also set the directory with `JEV_CHECKPOINT`. If you omit `--variant`, the loader reads the variant from the checkpoint configuration. Use `--variant qwen-audio-3.1-jev` for Qwen-Audio-3.1-Jev or `--variant qwen-audio-3.1-jev-tiny` for Qwen-Audio-3.1-Jev-Tiny. The loader also recognizes checkpoint architecture keys `base` and `tiny`. Use weights and a tokenizer trained for the system/request → user/audio/`` layout. Older prompt checkpoints require their matching inference code; changing only the tokenizer does not migrate a model. ```bash CUDA_VISIBLE_DEVICES=0 qwen-audio-jev \ --variant qwen-audio-3.1-jev --checkpoint /path/to/jev-base-hf \ --input /path/to/request.json --output output-base.json CUDA_VISIBLE_DEVICES=0 qwen-audio-jev \ --variant qwen-audio-3.1-jev-tiny --checkpoint /path/to/jev-tiny-hf \ --input /path/to/request.json --output output-tiny.json ``` The Python API accepts the same request: ```python import json from pathlib import Path from qwen_audio_jev import JevModel path = Path("/path/to/request.json") request = json.loads(path.read_text(encoding="utf-8")) base = JevModel(checkpoint="/path/to/jev-base-hf", variant="qwen-audio-3.1-jev") base_result = base.infer(request, base_dir=path.parent) tiny = JevModel(checkpoint="/path/to/jev-tiny-hf", variant="qwen-audio-3.1-jev-tiny") tiny_result = tiny.infer(request, base_dir=path.parent) ``` See [Inference Environments and Model Weights](environment.md) for BF16 weight sizes and [Input and Output](input-output.md) for request fields. ## Using `from_pretrained()` After installing the repository, load the model and processor directly: ```python import torch from qwen_audio_jev import JevForAudioDecision, JevProcessor checkpoint = "/path/to/jev-base-hf" # Use /path/to/jev-tiny-hf for Qwen-Audio-3.1-Jev-Tiny. processor = JevProcessor.from_pretrained(checkpoint) model = JevForAudioDecision.from_pretrained( checkpoint, dtype=torch.bfloat16, device_map={"": "cuda:0"}, ) inputs = processor("/path/to/request.json").to("cuda:0") with torch.inference_mode(): output = model(**inputs) ``` `output.choice_logits`, `output.noul_logits`, and `output.score_logits` correspond to the three decision heads. For structured JSON with probabilities and score mappings, use `JevModel.predict()` as shown in the [Python example](../examples/README.md#python) or use the CLI. ## Loading with `AutoModel` If the checkpoint includes its model and configuration code, you can use the standard Hugging Face interface: ```python from transformers import AutoModel import torch model = AutoModel.from_pretrained( "/path/to/jev-tiny-hf", trust_remote_code=True, # Use /path/to/jev-base-hf for Qwen-Audio-3.1-Jev. dtype=torch.bfloat16, device_map={"": "cuda:0"}, local_files_only=True, ) ``` Load model code from sources you trust. The loader validates all parameters, freezes them, and sets evaluation mode. Run forward passes with gradients disabled and one question per request. To use physical GPU 1, set `CUDA_VISIBLE_DEVICES=1` and keep `cuda:0` in the device map. The model reads the hidden state of `` at the end of the User audio message for its decision. Qwen-Audio-3.1-Jev-Tiny streaming reads each `` state; see [Streaming](streaming.md). The response protocol maps Score outputs to the requested scale. See [Input and Output](input-output.md) for the formula. ## Dependencies Follow [HF Dependency Installation](dependencies.md) to set up PyTorch, TorchAudio, Transformers, Accelerate, Safetensors, and the audio frontend. FLA and causal-conv1d are optional. PyTorch provides the fallback implementation. BF16 results can vary across kernels.