Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set model en_v6 while using torch.hub.load ❓ Questions / Help / Support #278

Open
g1ra opened this issue May 9, 2024 · 0 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@g1ra
Copy link

g1ra commented May 9, 2024

❓ 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                                                                              

@g1ra g1ra added the help wanted Extra attention is needed label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants