silero-models
silero-models copied to clipboard
How to set model en_v6 while using torch.hub.load ❓ Questions / Help / Support
❓ Questions and Help
I'm trying a pytorch example of STT . I can't figure out how to set the provided model (en_v5 , en_v6) .
My code is :
import torch
import zipfile
import torchaudio
from glob import glob
device = torch.device('cpu') # gpu also works, but our models are fast enough for CPU
model, decoder, utils = torch.hub.load(repo_or_dir='snakers4/silero-models',
model='en_v6',
# jit_model='jit_xlarge',
language='en', # also available 'de', 'es'
device=device)
(read_batch, split_into_batches,
read_audio, prepare_model_input) = utils # see function signature for details
# download a single file in any format compatible with TorchAudio
torch.hub.download_url_to_file('https://opus-codec.org/static/examples/samples/speech_orig.wav',
dst ='speech_orig.wav', progress=True)
test_files = glob('M.wav')
batches = split_into_batches(test_files, batch_size=10)
input = prepare_model_input(read_batch(batches[0]),
device=device)
output = model(input)
for example in output:
print(decoder(example.cpu()))
File "/home/bob/anaconda3/envs/sileroc/lib/python3.10/site-packages/torch/hub.py", line 347, in _load_entry_from_hubconf
raise RuntimeError(f'Cannot find callable {model} in hubconf')
RuntimeError: Cannot find callable en_v6 in hubconf