Advertisement
Guest User

Untitled

a guest
Jan 25th, 2023
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. # V3
  2. import os
  3. import torch
  4.  
  5. device = torch.device('cpu')
  6. torch.set_num_threads(4)
  7. local_file = 'model.pt'
  8.  
  9. if not os.path.isfile(local_file):
  10. torch.hub.download_url_to_file('https://models.silero.ai/models/tts/ru/v3_1_ru.pt',
  11. local_file)
  12.  
  13. model = torch.package.PackageImporter(local_file).load_pickle("tts_models", "model")
  14. model.to(device)
  15.  
  16. example_text = 'дд+ддавай пп+ппротт+ттестт+ттируемм+мм нашегг+гго заику ботт+тта'
  17. sample_rate = 48000
  18. speaker='aidar'
  19.  
  20. audio_paths = model.save_wav(text=example_text,
  21. speaker=speaker,
  22. sample_rate=sample_rate)
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement