SenseVoice
SenseVoice copied to clipboard
如何使用GPU
使用模型iic/SenseVoiceSmall推理的时候,监控gpu运行情况watch -d -n 0.5 nvidia-smi 查看到并没有使用gpu,如何使用呢,是否需要设置什么参数
用什么代码推理的?用funasr不是直接可以设置device吗?
from funasr import AutoModel
from funasr.utils.postprocess_utils import rich_transcription_postprocess
model_dir = "iic/SenseVoiceSmall"
model = AutoModel(
model=model_dir,
vad_model="fsmn-vad",
vad_kwargs={"max_single_segment_time": 30000},
device="cuda:0",
)
# en
res = model.generate(
input=f"{model.model_path}/example/en.mp3",
cache={},
language="auto", # "zn", "en", "yue", "ja", "ko", "nospeech"
use_itn=True,
batch_size_s=60,
merge_vad=True, #
merge_length_s=15,
)
text = rich_transcription_postprocess(res[0]["text"])
print(text)