Skip to content
Discussion options

You must be logged in to vote

更正一下之前的回复:dtype="bf16" 不是 AutoModel 这条 PyTorch 推理路径的精度开关;也不要把 fp16=Truebf16=True 放在 AutoModel(...) 构造器中。

这个报错与 GPU 型号无关,根因是构造器中的 fp16=True 会把整个模型转成 FP16,其中包括必须保持 FP32 的 SenseVoice 音频编码器;输入和部分算子仍是 FP32,因此会出现 Float / Half dtype mismatch。

请先升级到包含 #2978 修复的版本(最早为 1.3.10,当前为 1.3.14),然后只在 generate() 阶段启用 BF16:

python -m pip install -U "funasr>=1.3.10"
from funasr import AutoModel

model = AutoModel(
    model="FunAudioLLM/Fun-ASR-Nano-2512",
    hub="hf",
    trust_remote_code=True,
    device="cuda:0",
    disable_update=True,
    # 这里不要传 fp16=True、bf16=True 或 dtype=...
)

result = model.generate(
    input="audio.wav",
    batch_size=1,
    language="中文",
    itn=True,
    bf16=True,  # 精…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by LauraGPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants