Пытался сделать программу на Python (в виртуальной среде):
синтез речи через модели Silero для Torch
Вот код:
import torch
import sounddevice
import time
language = "ru"
model_id = "ru_v3"
sample_rate = 48000
speaker = "baya"
put_accent = True
put_yo = True
device = torch.device("cpu")
text = "Привет"
model, empty = torch.hub.load(repo_or_dir='snakers4/silero-models',
model='silero_tts',
language=language,
speaker=model_id)
model.to(device)
audio = model.apply_tts(text = text,
speaker = speaker,
sample_rate = sample_rate,
put_accent = put_accent,
put_yo = put_yo)
print(text)
sounddevice.play(audio, sample_rate)
time.sleep(len(audio) / sample_rate + 0.1)
sounddevice.stop()
Запустив 1-ый раз программу и у меня создался файл:
latest_silero_models.yml
и вылетела ошибка... Я подумал так и должно
Запускаю 2-ой раз файл уже не создается, а читается (как я понял)
и вылезает ошибка (не помню эта та же самая ошибка или нет):
Using cache found in /home/methodius/.cache/torch/hub/snakers4_silero-models_master
Traceback (most recent call last):
File "Pre-release-0.1/main.py", line 14, in <module>
model, empty = torch.hub.load(repo_or_dir='snakers4/silero-models',
File "/home/methodius/Projects/Python/VoiceAssistant/.virtual/lib/python3.8/site-packages/torch/hub.py", line 399, in load
model = _load_local(repo_or_dir, model, *args, **kwargs)
File "/home/methodius/Projects/Python/VoiceAssistant/.virtual/lib/python3.8/site-packages/torch/hub.py", line 428, in _load_local
model = entry(*args, **kwargs)
File "/home/methodius/.cache/torch/hub/snakers4_silero-models_master/src/silero/silero.py", line 88, in silero_tts
model = imp.load_pickle("tts_models", "model")
File "/home/methodius/Projects/Python/VoiceAssistant/.virtual/lib/python3.8/site-packages/torch/package/package_importer.py", line 249, in load_pickle
result = unpickler.load()
File "/usr/local/lib/python3.8/pickle.py", line 1212, in load
dispatch[key[0]](self)
File "/usr/local/lib/python3.8/pickle.py", line 1253, in load_binpersid
self.append(self.persistent_load(pid))
File "/home/methodius/Projects/Python/VoiceAssistant/.virtual/lib/python3.8/site-packages/torch/package/package_importer.py", line 227, in persistent_load
loaded_reduces[reduce_id] = func(self, *args)
File "/home/methodius/Projects/Python/VoiceAssistant/.virtual/lib/python3.8/site-packages/torch/jit/_script.py", line 344, in unpackage_script_module
cpp_module = torch._C._import_ir_module_from_package(
RuntimeError: Unknown qengine
Системные характеристики:
Linux Manjaro Kde 21.2.6
Python 3.8.13
Torch 10.0.0+cpu
Torchaudio 0.10.0