【环境】800 i a2
python 3.11.10
torch 2.4.0
openfst1.8.3 pynini==2.1.6
WeTextProcessing 1.0.4.1
【案例】
Modelzoo Cosyvocie
【步骤】
1、源码编译安装openfst1.8.3 pynini==2.1.6
2、atc 模型转换,第三个模型flow_sim.onnx张量的第一个维度改成了2,执行成功
3、CosyVoice代码版本为master
4、执行推理报错
root@localhost:/home/1/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice/CosyVoice# python3 infer.py --model_path=CosyVoice-300M/ --campplus=../campplus_linux_aarch64.om --speech=../speech_linux_aarch64.om --flow=../flow_linux_aarch64.om
/usr/local/python3.11.10/lib/python3.11/site-packages/torch_npu/contrib/transfer_to_npu.py:305: ImportWarning:
*************************************************************************************************************
The torch.Tensor.cuda and torch.nn.Module.cuda are replaced with torch.Tensor.npu and torch.nn.Module.npu now..
The torch.cuda.DoubleTensor is replaced with torch.npu.FloatTensor cause the double type is not supported now..
The backend in torch.distributed.init_process_group set to hccl now..
The torch.cuda.* and torch.cuda.amp.* are replaced with torch.npu.* and torch.npu.amp.* now..
The device parameters have been replaced with npu in the function below:
torch.logspace, torch.randint, torch.hann_window, torch.rand, torch.full_like, torch.ones_like, torch.rand_like, torch.randperm, torch.arange, torch.frombuffer, torch.normal, torch._empty_per_channel_affine_quantized, torch.empty_strided, torch.empty_like, torch.scalar_tensor, torch.tril_indices, torch.bartlett_window, torch.ones, torch.sparse_coo_tensor, torch.randn, torch.kaiser_window, torch.tensor, torch.triu_indices, torch.as_tensor, torch.zeros, torch.randint_like, torch.full, torch.eye, torch._sparse_csr_tensor_unsafe, torch.empty, torch._sparse_coo_tensor_unsafe, torch.blackman_window, torch.zeros_like, torch.range, torch.sparse_csr_tensor, torch.randn_like, torch.from_file, torch._cudnn_init_dropout_state, torch._empty_affine_quantized, torch.linspace, torch.hamming_window, torch.empty_quantized, torch._pin_memory, torch.autocast, torch.load, torch.Generator, torch.set_default_device, torch.Tensor.new_empty, torch.Tensor.new_empty_strided, torch.Tensor.new_full, torch.Tensor.new_ones, torch.Tensor.new_tensor, torch.Tensor.new_zeros, torch.Tensor.to, torch.nn.Module.to, torch.nn.Module.to_empty
*************************************************************************************************************
warnings.warn(msg, ImportWarning)
/usr/local/python3.11.10/lib/python3.11/site-packages/torch_npu/contrib/transfer_to_npu.py:260: RuntimeWarning: torch.jit.script and torch.jit.script_method will be disabled by transfer_to_npu, which currently does not support them, if you need to enable them, please do not use transfer_to_npu.
warnings.warn(msg, RuntimeWarning)
2025-02-10 02:17:40,291 - modelscope - INFO - PyTorch version 2.4.0 Found.
2025-02-10 02:17:40,292 - modelscope - INFO - Loading ast index from /root/.cache/modelscope/ast_indexer
2025-02-10 02:17:40,344 - modelscope - INFO - Loading done! Current index file version is 1.15.0, with md5 62a11d33f5159842f6d931ce1589f4aa and a total number of 980 components indexed
failed to import ttsfrd, use WeTextProcessing instead
Traceback (most recent call last):
File "/home/1/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice/CosyVoice/cosyvoice/cli/frontend.py", line 28, in <module>
import ttsfrd
ModuleNotFoundError: No module named 'ttsfrd'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/1/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice/CosyVoice/infer.py", line 26, in <module>
from cosyvoice.cli.cosyvoice import CosyVoice
File "/home/1/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice/CosyVoice/cosyvoice/cli/cosyvoice.py", line 21, in <module>
from cosyvoice.cli.frontend import CosyVoiceFrontEnd
File "/home/1/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice/CosyVoice/cosyvoice/cli/frontend.py", line 32, in <module>
from tn.chinese.normalizer import Normalizer as ZhNormalizer
File "/usr/local/python3.11.10/lib/python3.11/site-packages/tn/chinese/normalizer.py", line 15, in <module>
from tn.processor import Processor
File "/usr/local/python3.11.10/lib/python3.11/site-packages/tn/processor.py", line 21, in <module>
from pynini import (cdrewrite, cross, difference, escape, Fst, shortestpath,
File "/usr/local/python3.11.10/lib/python3.11/site-packages/pynini-2.1.6-py3.11-linux-aarch64.egg/pynini/__init__.py", line 1, in <module>
from _pynini import *
File "extensions/_pynini.pyx", line 1, in init _pynini
ImportError: /usr/local/python3.11.10/lib/python3.11/site-packages/pynini-2.1.6-py3.11-linux-aarch64.egg/_pywrapfst.cpython-311-aarch64-linux-gnu.so: undefined symbol: _ZNK3fst11SymbolTable9WriteTextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt17basic_string_viewIcS4_E
[ERROR] 2025-02-10-02:17:44 (PID:27917, Device:-1, RankID:-1) ERR99999 UNKNOWN applicaiton exception
/usr/local/python3.11.10/lib/python3.11/tempfile.py:934: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/tmpvcvavb9m'>
_warnings.warn(warn_message, ResourceWarning)
【环境】800 i a2
python 3.11.10
torch 2.4.0
openfst1.8.3 pynini==2.1.6
WeTextProcessing 1.0.4.1
【案例】
Modelzoo Cosyvocie
【步骤】
1、源码编译安装openfst1.8.3 pynini==2.1.6
2、atc 模型转换,第三个模型flow_sim.onnx张量的第一个维度改成了2,执行成功
3、CosyVoice代码版本为master
4、执行推理报错
root@localhost:/home/1/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice/CosyVoice# python3 infer.py --model_path=CosyVoice-300M/ --campplus=../campplus_linux_aarch64.om --speech=../speech_linux_aarch64.om --flow=../flow_linux_aarch64.om
/usr/local/python3.11.10/lib/python3.11/site-packages/torch_npu/contrib/transfer_to_npu.py:305: ImportWarning:
*************************************************************************************************************
The torch.Tensor.cuda and torch.nn.Module.cuda are replaced with torch.Tensor.npu and torch.nn.Module.npu now..
The torch.cuda.DoubleTensor is replaced with torch.npu.FloatTensor cause the double type is not supported now..
The backend in torch.distributed.init_process_group set to hccl now..
The torch.cuda.* and torch.cuda.amp.* are replaced with torch.npu.* and torch.npu.amp.* now..
The device parameters have been replaced with npu in the function below:
torch.logspace, torch.randint, torch.hann_window, torch.rand, torch.full_like, torch.ones_like, torch.rand_like, torch.randperm, torch.arange, torch.frombuffer, torch.normal, torch._empty_per_channel_affine_quantized, torch.empty_strided, torch.empty_like, torch.scalar_tensor, torch.tril_indices, torch.bartlett_window, torch.ones, torch.sparse_coo_tensor, torch.randn, torch.kaiser_window, torch.tensor, torch.triu_indices, torch.as_tensor, torch.zeros, torch.randint_like, torch.full, torch.eye, torch._sparse_csr_tensor_unsafe, torch.empty, torch._sparse_coo_tensor_unsafe, torch.blackman_window, torch.zeros_like, torch.range, torch.sparse_csr_tensor, torch.randn_like, torch.from_file, torch._cudnn_init_dropout_state, torch._empty_affine_quantized, torch.linspace, torch.hamming_window, torch.empty_quantized, torch._pin_memory, torch.autocast, torch.load, torch.Generator, torch.set_default_device, torch.Tensor.new_empty, torch.Tensor.new_empty_strided, torch.Tensor.new_full, torch.Tensor.new_ones, torch.Tensor.new_tensor, torch.Tensor.new_zeros, torch.Tensor.to, torch.nn.Module.to, torch.nn.Module.to_empty
*************************************************************************************************************
warnings.warn(msg, ImportWarning)
/usr/local/python3.11.10/lib/python3.11/site-packages/torch_npu/contrib/transfer_to_npu.py:260: RuntimeWarning: torch.jit.script and torch.jit.script_method will be disabled by transfer_to_npu, which currently does not support them, if you need to enable them, please do not use transfer_to_npu.
warnings.warn(msg, RuntimeWarning)
2025-02-10 02:17:40,291 - modelscope - INFO - PyTorch version 2.4.0 Found.
2025-02-10 02:17:40,292 - modelscope - INFO - Loading ast index from /root/.cache/modelscope/ast_indexer
2025-02-10 02:17:40,344 - modelscope - INFO - Loading done! Current index file version is 1.15.0, with md5 62a11d33f5159842f6d931ce1589f4aa and a total number of 980 components indexed
failed to import ttsfrd, use WeTextProcessing instead
Traceback (most recent call last):
File "/home/1/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice/CosyVoice/cosyvoice/cli/frontend.py", line 28, in <module>
import ttsfrd
ModuleNotFoundError: No module named 'ttsfrd'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/1/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice/CosyVoice/infer.py", line 26, in <module>
from cosyvoice.cli.cosyvoice import CosyVoice
File "/home/1/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice/CosyVoice/cosyvoice/cli/cosyvoice.py", line 21, in <module>
from cosyvoice.cli.frontend import CosyVoiceFrontEnd
File "/home/1/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice/CosyVoice/cosyvoice/cli/frontend.py", line 32, in <module>
from tn.chinese.normalizer import Normalizer as ZhNormalizer
File "/usr/local/python3.11.10/lib/python3.11/site-packages/tn/chinese/normalizer.py", line 15, in <module>
from tn.processor import Processor
File "/usr/local/python3.11.10/lib/python3.11/site-packages/tn/processor.py", line 21, in <module>
from pynini import (cdrewrite, cross, difference, escape, Fst, shortestpath,
File "/usr/local/python3.11.10/lib/python3.11/site-packages/pynini-2.1.6-py3.11-linux-aarch64.egg/pynini/__init__.py", line 1, in <module>
from _pynini import *
File "extensions/_pynini.pyx", line 1, in init _pynini
ImportError: /usr/local/python3.11.10/lib/python3.11/site-packages/pynini-2.1.6-py3.11-linux-aarch64.egg/_pywrapfst.cpython-311-aarch64-linux-gnu.so: undefined symbol: _ZNK3fst11SymbolTable9WriteTextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt17basic_string_viewIcS4_E
[ERROR] 2025-02-10-02:17:44 (PID:27917, Device:-1, RankID:-1) ERR99999 UNKNOWN applicaiton exception
/usr/local/python3.11.10/lib/python3.11/tempfile.py:934: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/tmpvcvavb9m'>
_warnings.warn(warn_message, ResourceWarning)