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

[BUG]: from torchaudio.functional.functional import _hz_to_mel, _mel_to_hz Error #304

Open
stevezhang88 opened this issue Oct 30, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@stevezhang88
Copy link

Describe the bug

运行demo代码时,在from import阶段就报错了。

How To Reproduce

from models.tts.maskgct.maskgct_utils import *
这句报错了


OSError Traceback (most recent call last)
Cell In[5], line 1
----> 1 from models.tts.maskgct.maskgct_utils import *
2 from huggingface_hub import hf_hub_download
3 import safetensors

File ~/autodl-tmp/Amphion/models/tts/maskgct/maskgct_utils.py:20
17 from utils.util import load_config
18 from tqdm import tqdm
---> 20 from models.codec.kmeans.repcodec_model import RepCodec
21 from models.tts.maskgct.maskgct_s2a import MaskGCT_S2A
22 from models.tts.maskgct.maskgct_t2s import MaskGCT_T2S

File ~/autodl-tmp/Amphion/models/codec/kmeans/repcodec_model.py:15
12 from einops import rearrange, repeat
14 from models.codec.amphion_codec.quantize import ResidualVQ
---> 15 from models.codec.kmeans.vocos import VocosBackbone
18 def init_weights(m):
19 if isinstance(m, nn.Conv1d):

File ~/autodl-tmp/Amphion/models/codec/kmeans/vocos.py:14
12 from torch import nn
13 from torch.nn.utils import weight_norm, remove_weight_norm
---> 14 from torchaudio.functional.functional import _hz_to_mel, _mel_to_hz
17 def safe_log(x: torch.Tensor, clip_val: float = 1e-7) -> torch.Tensor:
18 """
19 Computes the element-wise logarithm of the input tensor with clipping to avoid near-zero values.
20
(...)
26 Tensor: Element-wise logarithm of the input tensor with clipping applied.
27 """

File ~/miniconda3/lib/python3.12/site-packages/torchaudio/init.py:2
1 # Initialize extension and backend first
----> 2 from . import _extension # noqa # usort: skip
3 from ._backend import ( # noqa # usort: skip
4 AudioMetaData,
5 get_audio_backend,
(...)
10 set_audio_backend,
11 )
13 from . import ( # noqa: F401
14 compliance,
15 datasets,
(...)
23 utils,
24 )

File ~/miniconda3/lib/python3.12/site-packages/torchaudio/_extension/init.py:38
36 _IS_ALIGN_AVAILABLE = False
37 if _IS_TORCHAUDIO_EXT_AVAILABLE:
---> 38 _load_lib("libtorchaudio")
40 import torchaudio.lib._torchaudio # noqa
42 _check_cuda_version()

File ~/miniconda3/lib/python3.12/site-packages/torchaudio/_extension/utils.py:60, in _load_lib(lib)
58 if not path.exists():
59 return False
---> 60 torch.ops.load_library(path)
61 return True

File ~/miniconda3/lib/python3.12/site-packages/torch/_ops.py:1032, in _Ops.load_library(self, path)
1027 path = _utils_internal.resolve_library_path(path)
1028 with dl_open_guard():
1029 # Import the shared library into the process, thus running its
1030 # static (global) initialization code in order to register custom
1031 # operators with the JIT.
-> 1032 ctypes.CDLL(path)
1033 self.loaded_libraries.add(path)

File ~/miniconda3/lib/python3.12/ctypes/init.py:379, in CDLL.init(self, name, mode, handle, use_errno, use_last_error, winmode)
376 self._FuncPtr = _FuncPtr
378 if handle is None:
--> 379 self._handle = _dlopen(self._name, mode)
380 else:
381 self._handle = handle

OSError: /root/miniconda3/lib/python3.12/site-packages/torchaudio/lib/libtorchaudio.so: undefined symbol: _ZNK3c105Error4whatEv

Environment Information

linux 环境 在autodl上运行的。

Additional context

(Add any other context about the problem here.)

@stevezhang88 stevezhang88 added the bug Something isn't working label Oct 30, 2024
@yuantuo666
Copy link
Collaborator

Hi, it seems the problem is with the libtorchaudio installation. Which command did you use to install the pytorch?
Maybe check the official docs for reference: https://pytorch.org/get-started/locally/#with-cuda

BTW, we prefer English issues so that more people around the world can participate and it is also easier for issue search.

@stevezhang88
Copy link
Author

Oh. I use mirror on the server of AUTODL.com. I choose one 4090 GPU and pytorch==2.3.0 cuda=12.1

@yuantuo666 yuantuo666 changed the title [BUG]: from torchaudio.functional.functional import _hz_to_mel, _mel_to_hz 报错 [BUG]: from torchaudio.functional.functional import _hz_to_mel, _mel_to_hz Error Oct 31, 2024
@yuantuo666
Copy link
Collaborator

It is possible to have environmental problems, so it is recommended to use conda to manage your environment and install the dependency from scratch following the provided env.sh file.

Miniconda Install: https://docs.anaconda.com/miniconda/miniconda-install/
Conda User Guide: https://docs.conda.io/projects/conda/en/latest/user-guide/getting-started.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants