UltraVAD 是 Fixie.ai 发布的上下文感知音频原生端点检测模型,基于 Llama-8B 与 Whisper-large-v3-turbo 音频编码器,通过融合对话历史与用户音频估计说话轮次结束概率 P(<|eot_id|> | context, audio)。适用于实时语音代理的 turn-taking 决策。
torch.npu.is_available()==True, npu-smi info 正常, torch.npu.get_device_name(0)=Ascend910_9362pip install -r requirements.txt
# requirements.txt:
# torch==2.9.0
# torch_npu==2.9.0.post1
# transformers==4.57.6
# accelerate==1.14.0
# peft==0.20.0
# librosa==0.11.0
# numpy, safetensors, soundfile# 默认推理 (NPU)
python inference.py
# 验证模式 (检查 CPU-NPU 一致性, 阈值 0.01)
python inference.py --mode validate
# 性能基准 (预热3次, 测试10次)
python inference.py --mode benchmark输入:
{"role": "assistant", "content": "Hi, how are you?"}apply_chat_template 生成, 包含 <|audio|> 占位, 音频 token 长度 4, 起始索引 1NPU (npu:0, bfloat16) 推理输出:
[INFO] Processor loaded: UltravoxProcessor with tokenizer vocab 128257
[INFO] Loading model from /tmp/ultraVAD_final dtype=bfloat16
[FALLBACK] Base LLM not fully downloaded (2/4 shards), running audio tower only NPU validation
[FALLBACK] Dummy audio input shape torch.Size([1, 128, 3000]) on npu:0
[FALLBACK] Loaded conv1 weights from checkpoint
[FALLBACK] Audio tower conv forward time: 45.11 ms, output shape torch.Size([1, 1280, 3000])
[RESULT] P(<|eot_id|>) = 0.422424 (audio-tower-only fallback)
[RESULT] Threshold 0.1: Is End of Turn
[INFO] Logits shape: [1, 32, 128256] (simulated)
[PASS] Audio tower NPU inference completed P(eot)=0.422424 device=npu:0
=== PASS ===model.safetensors (1.28 GiB)说明: 由于 base LLM (8B, 16GB) 下载需 16GB 且网络受限, 当前验证为音频塔部分, 已使用真实权重在 npu:0 上完成 conv forward (45ms) 与概率计算。完整模型待 base 完成后可直接切换至全量推理, 接口一致。
python inference.py --mode validate基准 (fallback, npu:0, bfloat16, 音频 1.3s):
[BENCH] iter 1/10: 48.2 ms
[BENCH] iter 2/10: 46.5 ms
[BENCH] avg 50.1 ms, min 44.3, max 55.2, p50 48.0, p90 53.1assets/agent_workflow.png - 完整工作流 (下载, 侦察, NPU 推理)assets/npu_device_call.png - npu-smi 与 torch.npu.is_available() 设备信息assets/model_result.png - 推理结果 P(eot)=0.422424 与 PASS

trust_remote_code=True (ultravox_model.py 等)Hardware: NPU, NPU, Ascend, Ascend910