-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
Hello, I encountered this issue while running to run the example pytorch inference on Windows 11.
example inference script
import sounddevice as sd
from optispeech.model import OptiSpeech
import torch
import time
device = torch.device("cpu")
checkpoint_path = "hf_models/checkpoints/lightspeech/en-us/hfc_female-en_us-checkpoint_epoch-2174_step-451407.ckpt"
model = OptiSpeech.load_from_checkpoint(checkpoint_path=checkpoint_path, map_location="cpu")
model = model.to(device)
model = model.eval()
text = "This is a test"
inference_inputs = model.prepare_input(text)
start = time.time()
inferenec_outputs = model.synthesise(inference_inputs)
end = time.time() - start
print(f"inference {end*1000:1f} ms")
inferenec_outputs = inferenec_outputs.as_numpy()
sd.play(inferenec_outputs.wav.squeeze(), model.sample_rate)
Error message
Traceback (most recent call last):
File "C:\Users\T\Desktop\code\optispeech\test_tts.py", line 8, in <module>
model = OptiSpeech.load_from_checkpoint(checkpoint_path=checkpoint_path, map_location="cpu")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\T\Desktop\code\optispeech\.venv\Lib\site-packages\lightning\pytorch\utilities\model_helpers.py", line 125, in wrapper
return self.method(cls, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\T\Desktop\code\optispeech\.venv\Lib\site-packages\lightning\pytorch\core\module.py", line 1582, in load_from_checkpoint
loaded = _load_from_checkpoint(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\T\Desktop\code\optispeech\.venv\Lib\site-packages\lightning\pytorch\core\saving.py", line 63, in _load_from_checkpoint
checkpoint = pl_load(checkpoint_path, map_location=map_location)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\T\Desktop\code\optispeech\.venv\Lib\site-packages\lightning\fabric\utilities\cloud_io.py", line 60, in _load
return torch.load(
^^^^^^^^^^^
File "C:\Users\T\Desktop\code\optispeech\.venv\Lib\site-packages\torch\serialization.py", line 1360, in load
return _load(
^^^^^^
File "C:\Users\T\Desktop\code\optispeech\.venv\Lib\site-packages\torch\serialization.py", line 1848, in _load
result = unpickler.load()
^^^^^^^^^^^^^^^^
File "C:\Users\T\AppData\Roaming\uv\python\cpython-3.11.11-windows-x86_64-none\Lib\pickle.py", line 1213, in load
dispatch[key[0]](self)
File "C:\Users\T\AppData\Roaming\uv\python\cpython-3.11.11-windows-x86_64-none\Lib\pickle.py", line 1529, in load_global
klass = self.find_class(module, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\T\Desktop\code\optispeech\.venv\Lib\site-packages\torch\serialization.py", line 1837, in find_class
return super().find_class(mod_name, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\T\Desktop\code\optispeech\.venv\Lib\site-packages\lightning\pytorch\utilities\migration\utils.py", line 198, in find_class
return super().find_class(new_module, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\T\AppData\Roaming\uv\python\cpython-3.11.11-windows-x86_64-none\Lib\pickle.py", line 1580, in find_class
__import__(module, level=0)
ModuleNotFoundError: No module named 'optispeech.model.generator.wavenext'
Ryu1845
Metadata
Metadata
Assignees
Labels
No labels