yl4579 / StyleTTS2

StyleTTS 2: Towards Human-Level Text-to-Speech through Style Diffusion and Adversarial Training with Large Speech Language Models
MIT License
4.98k stars 422 forks source link

ImportError: A module that was compiled using NumPy 1.x cannot be run in NumPy 2.0.1 #275

Closed Geremia closed 3 months ago

Geremia commented 3 months ago
$ accelerate launch train_first.py --config_path ./Configs/config.yml
The following values were not passed to `accelerate launch` and had defaults used instead:
        `--num_processes` was set to a value of `1`
        `--num_machines` was set to a value of `1`
        `--mixed_precision` was set to a value of `'no'`
        `--dynamo_backend` was set to a value of `'no'`
To avoid this warning pass in values for each of the problematic parameters or run `accelerate config`.

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.1 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "/tmp/StyleTTS2/train_first.py", line 21, in <module>
    import torchaudio
  File "/tmp/audio/src/torchaudio/__init__.py", line 13, in <module>
    from . import (  # noqa: F401
  File "/tmp/audio/src/torchaudio/compliance/__init__.py", line 1, in <module>
    from . import kaldi
  File "/tmp/audio/src/torchaudio/compliance/kaldi.py", line 22, in <module>
    EPSILON = torch.tensor(torch.finfo(torch.float).eps)

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.1 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "/tmp/StyleTTS2/train_first.py", line 26, in <module>
    from utils import *
  File "/tmp/StyleTTS2/utils.py", line 11, in <module>
    import matplotlib.pyplot as plt
  File "/usr/lib64/python3.11/site-packages/matplotlib/__init__.py", line 107, in <module>
    from . import _api, cbook, docstring, rcsetup
  File "/usr/lib64/python3.11/site-packages/matplotlib/rcsetup.py", line 26, in <module>
    from matplotlib.colors import Colormap, is_color_like
  File "/usr/lib64/python3.11/site-packages/matplotlib/colors.py", line 82, in <module>
    from matplotlib import _api, cbook, scale
  File "/usr/lib64/python3.11/site-packages/matplotlib/scale.py", line 18, in <module>
    from matplotlib.ticker import (
  File "/usr/lib64/python3.11/site-packages/matplotlib/ticker.py", line 179, in <module>
    from matplotlib import transforms as mtransforms
  File "/usr/lib64/python3.11/site-packages/matplotlib/transforms.py", line 46, in <module>
    from matplotlib._path import (
Traceback (most recent call last):
  File "/usr/lib64/python3.11/site-packages/numpy/core/_multiarray_umath.py", line 44, in __getattr__
    raise ImportError(msg)
ImportError: 
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.1 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):
  File "/tmp/StyleTTS2/train_first.py", line 26, in <module>
    from utils import *
  File "/tmp/StyleTTS2/utils.py", line 11, in <module>
    import matplotlib.pyplot as plt
  File "/usr/lib64/python3.11/site-packages/matplotlib/__init__.py", line 107, in <module>
    from . import _api, cbook, docstring, rcsetup
  File "/usr/lib64/python3.11/site-packages/matplotlib/rcsetup.py", line 26, in <module>
    from matplotlib.colors import Colormap, is_color_like
  File "/usr/lib64/python3.11/site-packages/matplotlib/colors.py", line 82, in <module>
    from matplotlib import _api, cbook, scale
  File "/usr/lib64/python3.11/site-packages/matplotlib/scale.py", line 18, in <module>
    from matplotlib.ticker import (
  File "/usr/lib64/python3.11/site-packages/matplotlib/ticker.py", line 179, in <module>
    from matplotlib import transforms as mtransforms
  File "/usr/lib64/python3.11/site-packages/matplotlib/transforms.py", line 46, in <module>
    from matplotlib._path import (
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
  File "/home/geremia/.local/bin/accelerate", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/geremia/.local/lib/python3.11/site-packages/accelerate/commands/accelerate_cli.py", line 48, in main
    args.func(args)
  File "/home/geremia/.local/lib/python3.11/site-packages/accelerate/commands/launch.py", line 1106, in launch_command
    simple_launcher(args)
  File "/home/geremia/.local/lib/python3.11/site-packages/accelerate/commands/launch.py", line 704, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', 'train_first.py', '--config_path', './Configs/config.yml']' returned non-zero exit status 1.

I'm on Linux with master StyleTTS2.

Geremia commented 3 months ago

Downgrade numpy: pip install numpy==1.26.4

🎩-tip: yuanlong-o