You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import torch
import onnxruntime
from pprint import pprint
_, utils = torch.hub.load(repo_or_dir='snakers4/silero-vad',
model='silero_vad',
force_reload=True)
(get_speech_ts,
_,_,
read_audio,
_, _, _) = utils
files_dir = torch.hub.get_dir() + '/snakers4_silero-vad_master/files'
def init_onnx_model(model_path: str):
return onnxruntime.InferenceSession(model_path)
def validate_onnx(model, inputs):
with torch.no_grad():
ort_inputs = {'input': inputs.cpu().numpy()}
outs = model.run(None, ort_inputs)
outs = [torch.Tensor(x) for x in outs]
return outs
model = init_onnx_model(f'{files_dir}/model.onnx')
wav = read_audio(f'{files_dir}/en.wav')
# get speech timestamps from full audio file
speech_timestamps = get_speech_ts(wav, model, num_steps=4, run_function=validate_onnx)
pprint(speech_timestamps)
Traceback (most recent call last):
File "1.py", line 30, in
speech_timestamps = get_speech_ts(wav, model, num_steps=4, run_function=validate_onnx)
File "/home/gary/.cache/torch/hub/snakers4_silero-vad_master/utils_vad.py", line 112, in get_speech_ts
outs = torch.cat(outs, dim=0)
TypeError: expected Tensor as element 0 in argument 0, but got list
when run onnx vad example, it showed the error
Traceback (most recent call last):
File "1.py", line 30, in
speech_timestamps = get_speech_ts(wav, model, num_steps=4, run_function=validate_onnx)
File "/home/gary/.cache/torch/hub/snakers4_silero-vad_master/utils_vad.py", line 112, in get_speech_ts
outs = torch.cat(outs, dim=0)
TypeError: expected Tensor as element 0 in argument 0, but got list
Originally posted by @garymmi in #58
The text was updated successfully, but these errors were encountered: