PaddleSpeech icon indicating copy to clipboard operation
PaddleSpeech copied to clipboard

ImportError: cannot import name 'sequence_mask' from 'paddle.fluid.layers'

Open openersoft opened this issue 9 months ago • 5 comments

系统:windows Python 3.11.5

安装的CPU版本 python -m pip install paddlepaddle==2.5.1 -i https://mirror.baidu.com/pypi/simple

然后 pip install paddlespeech -i https://pypi.tuna.tsinghua.edu.cn/simple

此时numpy 版本为numpy-1.24.4

运行 paddlespeech cls --input zh.wav

PS D:\work\mgsdk\doc> paddlespeech cls --input zh.wav Traceback (most recent call last): File "", line 198, in run_module_as_main File "", line 88, in run_code File "C:\Users\mghua\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts\paddlespeech.exe_main.py", line 4, in File "C:\Users\mghua\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\paddlespeech\cli_init.py", line 16, in from .asr import ASRExecutor File "C:\Users\mghua\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\paddlespeech\cli\asr_init_.py", line 14, in from .infer import ASRExecutor File "C:\Users\mghua\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\paddlespeech\cli\asr\infer.py", line 22, in import librosa File "C:\Users\mghua\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\librosa_init_.py", line 211, in from . import core File "C:\Users\mghua\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\librosa\core_init_.py", line 9, in from .constantq import * # pylint: disable=wildcard-import ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mghua\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\librosa\core\constantq.py", line 1059, in dtype=np.complex, ^^^^^^^^^^ File "C:\Users\mghua\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\numpy_init_.py", line 305, in getattr raise AttributeError(former_attrs[attr]) AttributeError: module 'numpy' has no attribute 'complex'. np.complex was a deprecated alias for the builtin complex. To avoid this error in existing code, use complex by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.complex128 here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'complex_'?

**将constantq.py中的np.complex, 改为 complex后,就又显示

ImportError: cannot import name 'sequence_mask' from 'paddle.fluid.layers'**

openersoft avatar Sep 14 '23 11:09 openersoft