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

No module named 'optispeech.model.generator.wavenext' error on Windows #17

Open
tn-17 opened this issue Jan 27, 2025 · 1 comment
Open

Comments

@tn-17
Copy link

tn-17 commented Jan 27, 2025

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'
@tn-17 tn-17 changed the title Does this project work on Windows? No module named 'optispeech.model.generator.wavenext' error on Windows Jan 27, 2025
@Ryu1845
Copy link

Ryu1845 commented Feb 11, 2025

Try reverting to an earlier commit, the one labeled "compatibility with mike" works. Or you could use the onnx models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants