按照这个教程安装cosyvoice2,运行后报错,'InferSession' object has no attribute 'set_context',请问该如何处理?
https://gitcode.com/Ascend/ModelZoo-PyTorch/tree/master/ACL_PyTorch/built-in/audio/CosyVoice2
以下为环境和运行信息。
环境信息
card : Atlas 300V Pro
os : Ubuntu 22.04.4 2024.12.04 LTS
cpu : Intel? Xeon(R) Silver 4110 CPU
npu-driver : 25.2.0
cann : 8.2.RC2
python : 3.10
+--------------------------------------------------------------------------------------------------------+
| npu-smi 25.2.0 Version: 25.2.0 |
+-------------------------------+-----------------+------------------------------------------------------+
| NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page) |
| Chip Device | Bus-Id | AICore(%) Memory-Usage(MB) |
+===============================+=================+======================================================+
| 25600 310P3 | OK | NA 37 0 / 0 |
| 0 0 | 0000:65:00.0 | 0 1911 / 44215 |
+===============================+=================+======================================================+
+-------------------------------+-----------------+------------------------------------------------------+
| NPU Chip | Process id | Process name | Process memory(MB) |
+===============================+=================+======================================================+
| No running processes found in NPU 25600 |
+===============================+=================+======================================================+
Package Version
------------------------- ------------
absl-py 2.4.0
aclruntime 0.0.2
addict 2.4.0
aiofiles 23.2.1
aiohappyeyeballs 2.6.1
aiohttp 3.13.5
aiosignal 1.4.0
ais_bench 0.0.2
aliyun-python-sdk-core 2.16.0
aliyun-python-sdk-kms 2.16.5
altair 5.5.0
annotated-doc 0.0.4
annotated-types 0.7.0
antlr4-python3-runtime 4.9.3
anyio 4.13.0
async-timeout 5.0.1
attrs 26.1.0
audioread 3.1.0
auto_tune 0.1.0
beautifulsoup4 4.14.3
certifi 2026.2.25
cffi 2.0.0
charset-normalizer 3.4.7
click 8.3.2
click-aliases 1.0.5
coloredlogs 15.0.1
conformer 0.3.2
contourpy 1.3.2
crcmod 1.7
cryptography 46.0.6
cycler 0.12.1
Cython 3.2.4
dataflow 0.0.1
datasets 2.18.0
decorator 5.2.1
deepspeed 0.14.2
diffusers 0.27.2
dill 0.3.8
dnspython 2.8.0
einops 0.8.2
email-validator 2.3.0
exceptiongroup 1.3.1
fastapi 0.111.0
fastapi-cli 0.0.4
ffmpy 1.0.0
filelock 3.25.2
flatbuffers 25.12.19
fonttools 4.62.1
frozenlist 1.8.0
fsspec 2024.2.0
gast 0.7.0
gdown 5.1.0
google-auth 2.49.1
google-auth-oauthlib 1.0.0
gradio 4.32.2
gradio_client 0.17.0
grpcio 1.57.0
grpcio-tools 1.57.0
h11 0.16.0
hccl 0.1.0
hccl_parser 0.1
hjson 3.1.0
httpcore 1.0.9
httptools 0.7.1
httpx 0.28.1
huggingface-hub 0.23.5
humanfriendly 10.0
hydra-core 1.3.2
HyperPyYAML 1.2.2
idna 3.11
importlib_metadata 9.0.0
importlib_resources 6.5.2
inflect 7.3.1
Jinja2 3.1.6
jmespath 0.10.0
joblib 1.5.3
jsonschema 4.26.0
jsonschema-specifications 2025.9.1
kiwisolver 1.5.0
lazy-loader 0.5
librosa 0.10.2
lightning 2.2.4
lightning-utilities 0.15.3
llm_datadist 0.0.1
llvmlite 0.47.0
Markdown 3.10.2
markdown-it-py 4.0.0
MarkupSafe 2.1.5
matplotlib 3.7.5
mdurl 0.1.2
modelscope 1.15.0
more-itertools 11.0.1
mpmath 1.3.0
msgpack 1.1.2
msit 8.2.0
msit-benchmark 8.2.0
msit-surgeon 8.2.0
msobjdump 0.1.0
multidict 6.7.1
multiprocess 0.70.16
narwhals 2.19.0
networkx 3.1
ninja 1.13.0
numba 0.65.0
numpy 1.26.4
nvidia-ml-py 13.595.45
oauthlib 3.3.1
omegaconf 2.3.0
onnx 1.16.0
onnxruntime 1.15.1
op_compile_tool 0.1.0
op_gen 0.1
op_test_frame 0.1
opc_tool 0.1.0
openai-whisper 20231117
orjson 3.11.8
oss2 2.19.1
packaging 24.2
pandas 2.3.3
pillow 10.4.0
pip 25.1
platformdirs 4.9.4
pooch 1.9.0
propcache 0.4.1
protobuf 4.25.0
psutil 7.2.2
py-cpuinfo 9.0.0
pyarrow 23.0.1
pyarrow-hotfix 0.7
pyasn1 0.6.3
pyasn1_modules 0.4.2
pycparser 3.0
pycryptodome 3.23.0
pydantic 2.7.0
pydantic_core 2.18.1
pydub 0.25.1
Pygments 2.20.0
pynini 2.1.6
pynvml 13.0.1
pyparsing 3.3.2
PySocks 1.7.1
python-dateutil 2.9.0.post0
python-dotenv 1.2.2
python-multipart 0.0.24
pytorch-lightning 2.6.1
pytz 2026.1.post1
pyworld 0.3.4
PyYAML 6.0.3
referencing 0.37.0
regex 2026.4.4
requests 2.33.1
requests-oauthlib 2.0.0
rich 13.7.1
rpds-py 0.30.0
ruamel.yaml 0.18.6
ruamel.yaml.clib 0.2.8
ruff 0.15.9
safetensors 0.7.0
schedule_search 0.0.1
scikit-learn 1.7.2
scipy 1.15.3
semantic-version 2.10.0
setuptools 78.1.1
shellingham 1.5.4
show_kernel_debug_data 0.1.0
simplejson 3.20.2
six 1.17.0
skl2onnx 1.20.0
sortedcontainers 2.4.0
soundfile 0.12.1
soupsieve 2.8.3
soxr 1.0.0
starlette 0.37.2
sympy 1.14.0
te 0.4.0
tensorboard 2.14.0
tensorboard-data-server 0.7.2
threadpoolctl 3.6.0
tiktoken 0.12.0
tokenizers 0.14.0
tomli 2.4.1
tomlkit 0.12.0
torch 2.3.1+cpu
torch-npu 2.3.1.post6
torchaudio 2.3.1+cpu
torchmetrics 1.9.0
tqdm 4.67.3
triton 2.3.1
typeguard 4.5.1
typer 0.24.1
typing_extensions 4.15.0
tzdata 2026.1
ujson 5.12.0
urllib3 2.6.3
uvicorn 0.30.0
uvloop 0.22.1
watchfiles 1.1.1
websockets 11.0.3
Werkzeug 3.1.8
WeTextProcessing 1.0.4.1
wget 3.2
wheel 0.45.1
xxhash 3.6.0
yapf 0.43.0
yarl 1.23.0
zipp 3.23.0
运行信息
(cosy_cann) python3 infer.py --model_path=CosyVoice2-0.5B --stream_out
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch/cuda/__init__.py:56: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
import pynvml # type: ignore[import]
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch_npu/utils/collect_env.py:59: UserWarning: Warning: The /usr/local/Ascend/ascend-toolkit/latest owner does not match the current owner.
warnings.warn(f"Warning: The {path} owner does not match the current owner.")
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch_npu/utils/collect_env.py:59: UserWarning: Warning: The /usr/local/Ascend/ascend-toolkit/8.2.RC2/x86_64-linux/ascend_toolkit_install.info owner does not match the current owner.
warnings.warn(f"Warning: The {path} owner does not match the current owner.")
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch_npu/contrib/transfer_to_npu.py:294: 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.Tensor.pin_memory, torch.nn.Module.to, torch.nn.Module.to_empty
*************************************************************************************************************
warnings.warn(msg, ImportWarning)
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch_npu/contrib/transfer_to_npu.py:249: 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)
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch_npu/dynamo/torchair/__init__.py:8: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/pkg_resources/__init__.py:3147: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
2026-04-07 15:49:18,775 - modelscope - INFO - PyTorch version 2.3.1+cpu Found.
2026-04-07 15:49:18,776 - modelscope - INFO - Loading ast index from /home/ds/.cache/modelscope/ast_indexer
2026-04-07 15:49:18,831 - modelscope - INFO - Loading done! Current index file version is 1.15.0, with md5 6aec0eb39b0ee6ed30f0f856f1761c23 and a total number of 980 components indexed
failed to import ttsfrd, use WeTextProcessing instead
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/lightning/fabric/__init__.py:41: Deprecated call to `pkg_resources.declare_namespace('lightning.fabric')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/pkg_resources/__init__.py:2559: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('lightning')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(parent)
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/matplotlib/_fontconfig_pattern.py:88: PyparsingDeprecationWarning: 'parseString' deprecated - use 'parse_string'
parse = parser.parseString(pattern)
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/matplotlib/_fontconfig_pattern.py:92: PyparsingDeprecationWarning: 'resetCache' deprecated - use 'reset_cache'
parser.resetCache()
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/matplotlib/_mathtext.py:30: PyparsingDeprecationWarning: 'enablePackrat' deprecated - use 'enable_packrat'
ParserElement.enablePackrat()
2026-04-07 15:49:26,291 WARNING In /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/matplotlib/mpl-data/stylelib/classic.mplstyle: 'parseString' deprecated - use 'parse_string'
2026-04-07 15:49:26,291 WARNING In /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/matplotlib/mpl-data/stylelib/classic.mplstyle: 'resetCache' deprecated - use 'reset_cache'
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/lightning/pytorch/__init__.py:37: Deprecated call to `pkg_resources.declare_namespace('lightning.pytorch')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/pkg_resources/__init__.py:2559: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('lightning')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(parent)
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/diffusers/models/lora.py:393: FutureWarning: `LoRACompatibleLinear` is deprecated and will be removed in version 1.0.0. Use of `LoRACompatibleLinear` is deprecated. Please switch to PEFT backend by installing PEFT: `pip install peft`.
deprecate("LoRACompatibleLinear", "1.0.0", deprecation_message)
2026-04-07 15:49:28,094 INFO input frame rate=25
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py:65: UserWarning: Specified provider 'CUDAExecutionProvider' is not in available provider names.Available providers: 'CPUExecutionProvider'
warnings.warn(
2026-04-07 15:49:37,131 WETEXT INFO building fst for zh_normalizer ...
2026-04-07 15:49:37,131 INFO building fst for zh_normalizer ...
2026-04-07 15:50:14,578 WETEXT INFO done
2026-04-07 15:50:14,578 INFO done
2026-04-07 15:50:14,578 WETEXT INFO fst path: /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/zh_tn_tagger.fst
2026-04-07 15:50:14,578 INFO fst path: /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/zh_tn_tagger.fst
2026-04-07 15:50:14,578 WETEXT INFO /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/zh_tn_verbalizer.fst
2026-04-07 15:50:14,578 INFO /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/zh_tn_verbalizer.fst
2026-04-07 15:50:14,583 WETEXT INFO found existing fst: /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/en_tn_tagger.fst
2026-04-07 15:50:14,583 INFO found existing fst: /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/en_tn_tagger.fst
2026-04-07 15:50:14,583 WETEXT INFO /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/en_tn_verbalizer.fst
2026-04-07 15:50:14,583 INFO /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/en_tn_verbalizer.fst
2026-04-07 15:50:14,583 WETEXT INFO skip building fst for en_normalizer ...
2026-04-07 15:50:14,583 INFO skip building fst for en_normalizer ...
[WARN] acl repeat initialize
[INFO] acl init success
[INFO] open device 0 success
[INFO] get current context
[INFO] load model CosyVoice2-0.5B/flow_linux_x86_64.om success
[INFO] create model description success
[INFO] create new context
[INFO] load model CosyVoice2-0.5B/flow_static.om success
[INFO] create model description success
[INFO] create new context
[INFO] load model CosyVoice2-0.5B/speech_linux_x86_64.om success
[INFO] create model description success
Removing weight norm...
warm up start
0%| | 0/1 [00:00<?, ?it/s]2026-04-07 15:51:02,249 INFO synthesis text 收到好友从远方寄来的生日礼物,那份意外的惊喜和深深的祝福,让我心中充满了甜蜜的快乐,笑容如花儿般绽放。
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch_npu/dynamo/torchair/_ge_concrete_graph/fx2ge_converter.py:954: UserWarning: When enable frozen_parameter, Parameters will be considered frozen.Please make sure that the Parameters data address remain the same throughout the program runtime.
warnings.warn(f'When enable frozen_parameter, Parameters will be considered frozen.'
...../home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch_npu/dynamo/torchair/_ge_concrete_graph/fx2ge_converter.py:954: UserWarning: When enable frozen_parameter, Parameters will be considered frozen.Please make sure that the Parameters data address remain the same throughout the program runtime.
warnings.warn(f'When enable frozen_parameter, Parameters will be considered frozen.'
0%| | 0/1 [02:52<?, ?it/s]
Traceback (most recent call last):
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/infer.py", line 118, in <module>
no_stream_input_inference(args, cosyvoice, prompt_txt)
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/infer.py", line 26, in no_stream_input_inference
for _ in enumerate(cosyvoice.inference_sft(prompt_txt[0], '中文女', stream=args.stream_out)):
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/cosyvoice/cli/cosyvoice.py", line 74, in inference_sft
for idx, model_output in enumerate(self.model.tts(**model_input, stream=stream, speed=speed)):
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/cosyvoice/cli/model.py", line 386, in tts
this_tts_speech = self.token2wav(token=this_tts_speech_token,
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/cosyvoice/cli/model.py", line 335, in token2wav
tts_mel, _ = self.flow.inference(token=token.to(self.device),
File "/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/cosyvoice/flow/flow.py", line 230, in inference
feat, _ = self.decoder(
File "/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/cosyvoice/flow/flow_matching.py", line 234, in forward
return self.solve_euler(z, t_span=t_span, mu=mu, mask=mask, spks=spks, cond=cond), None
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/cosyvoice/flow/flow_matching.py", line 116, in solve_euler
self.flow_om.set_context()
AttributeError: 'InferSession' object has no attribute 'set_context'
[ERROR] 2026-04-07-15:54:05 (PID:837388, Device:0, RankID:-1) ERR99999 UNKNOWN application exception
[INFO] unload model success, model Id is 2147483649
[INFO] unload model success, model Id is 2147483648
[INFO] unload model success, model Id is 2
[WARN] acl repeat destroy
https://gitcode.com/Ascend/ModelZoo-PyTorch/tree/master/ACL_PyTorch/built-in/audio/CosyVoice2
以下为环境和运行信息。
环境信息
card : Atlas 300V Pro
os : Ubuntu 22.04.4 2024.12.04 LTS
cpu : Intel? Xeon(R) Silver 4110 CPU
npu-driver : 25.2.0
cann : 8.2.RC2
python : 3.10
+--------------------------------------------------------------------------------------------------------+
| npu-smi 25.2.0 Version: 25.2.0 |
+-------------------------------+-----------------+------------------------------------------------------+
| NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page) |
| Chip Device | Bus-Id | AICore(%) Memory-Usage(MB) |
+===============================+=================+======================================================+
| 25600 310P3 | OK | NA 37 0 / 0 |
| 0 0 | 0000:65:00.0 | 0 1911 / 44215 |
+===============================+=================+======================================================+
+-------------------------------+-----------------+------------------------------------------------------+
| NPU Chip | Process id | Process name | Process memory(MB) |
+===============================+=================+======================================================+
| No running processes found in NPU 25600 |
+===============================+=================+======================================================+
Package Version
------------------------- ------------
absl-py 2.4.0
aclruntime 0.0.2
addict 2.4.0
aiofiles 23.2.1
aiohappyeyeballs 2.6.1
aiohttp 3.13.5
aiosignal 1.4.0
ais_bench 0.0.2
aliyun-python-sdk-core 2.16.0
aliyun-python-sdk-kms 2.16.5
altair 5.5.0
annotated-doc 0.0.4
annotated-types 0.7.0
antlr4-python3-runtime 4.9.3
anyio 4.13.0
async-timeout 5.0.1
attrs 26.1.0
audioread 3.1.0
auto_tune 0.1.0
beautifulsoup4 4.14.3
certifi 2026.2.25
cffi 2.0.0
charset-normalizer 3.4.7
click 8.3.2
click-aliases 1.0.5
coloredlogs 15.0.1
conformer 0.3.2
contourpy 1.3.2
crcmod 1.7
cryptography 46.0.6
cycler 0.12.1
Cython 3.2.4
dataflow 0.0.1
datasets 2.18.0
decorator 5.2.1
deepspeed 0.14.2
diffusers 0.27.2
dill 0.3.8
dnspython 2.8.0
einops 0.8.2
email-validator 2.3.0
exceptiongroup 1.3.1
fastapi 0.111.0
fastapi-cli 0.0.4
ffmpy 1.0.0
filelock 3.25.2
flatbuffers 25.12.19
fonttools 4.62.1
frozenlist 1.8.0
fsspec 2024.2.0
gast 0.7.0
gdown 5.1.0
google-auth 2.49.1
google-auth-oauthlib 1.0.0
gradio 4.32.2
gradio_client 0.17.0
grpcio 1.57.0
grpcio-tools 1.57.0
h11 0.16.0
hccl 0.1.0
hccl_parser 0.1
hjson 3.1.0
httpcore 1.0.9
httptools 0.7.1
httpx 0.28.1
huggingface-hub 0.23.5
humanfriendly 10.0
hydra-core 1.3.2
HyperPyYAML 1.2.2
idna 3.11
importlib_metadata 9.0.0
importlib_resources 6.5.2
inflect 7.3.1
Jinja2 3.1.6
jmespath 0.10.0
joblib 1.5.3
jsonschema 4.26.0
jsonschema-specifications 2025.9.1
kiwisolver 1.5.0
lazy-loader 0.5
librosa 0.10.2
lightning 2.2.4
lightning-utilities 0.15.3
llm_datadist 0.0.1
llvmlite 0.47.0
Markdown 3.10.2
markdown-it-py 4.0.0
MarkupSafe 2.1.5
matplotlib 3.7.5
mdurl 0.1.2
modelscope 1.15.0
more-itertools 11.0.1
mpmath 1.3.0
msgpack 1.1.2
msit 8.2.0
msit-benchmark 8.2.0
msit-surgeon 8.2.0
msobjdump 0.1.0
multidict 6.7.1
multiprocess 0.70.16
narwhals 2.19.0
networkx 3.1
ninja 1.13.0
numba 0.65.0
numpy 1.26.4
nvidia-ml-py 13.595.45
oauthlib 3.3.1
omegaconf 2.3.0
onnx 1.16.0
onnxruntime 1.15.1
op_compile_tool 0.1.0
op_gen 0.1
op_test_frame 0.1
opc_tool 0.1.0
openai-whisper 20231117
orjson 3.11.8
oss2 2.19.1
packaging 24.2
pandas 2.3.3
pillow 10.4.0
pip 25.1
platformdirs 4.9.4
pooch 1.9.0
propcache 0.4.1
protobuf 4.25.0
psutil 7.2.2
py-cpuinfo 9.0.0
pyarrow 23.0.1
pyarrow-hotfix 0.7
pyasn1 0.6.3
pyasn1_modules 0.4.2
pycparser 3.0
pycryptodome 3.23.0
pydantic 2.7.0
pydantic_core 2.18.1
pydub 0.25.1
Pygments 2.20.0
pynini 2.1.6
pynvml 13.0.1
pyparsing 3.3.2
PySocks 1.7.1
python-dateutil 2.9.0.post0
python-dotenv 1.2.2
python-multipart 0.0.24
pytorch-lightning 2.6.1
pytz 2026.1.post1
pyworld 0.3.4
PyYAML 6.0.3
referencing 0.37.0
regex 2026.4.4
requests 2.33.1
requests-oauthlib 2.0.0
rich 13.7.1
rpds-py 0.30.0
ruamel.yaml 0.18.6
ruamel.yaml.clib 0.2.8
ruff 0.15.9
safetensors 0.7.0
schedule_search 0.0.1
scikit-learn 1.7.2
scipy 1.15.3
semantic-version 2.10.0
setuptools 78.1.1
shellingham 1.5.4
show_kernel_debug_data 0.1.0
simplejson 3.20.2
six 1.17.0
skl2onnx 1.20.0
sortedcontainers 2.4.0
soundfile 0.12.1
soupsieve 2.8.3
soxr 1.0.0
starlette 0.37.2
sympy 1.14.0
te 0.4.0
tensorboard 2.14.0
tensorboard-data-server 0.7.2
threadpoolctl 3.6.0
tiktoken 0.12.0
tokenizers 0.14.0
tomli 2.4.1
tomlkit 0.12.0
torch 2.3.1+cpu
torch-npu 2.3.1.post6
torchaudio 2.3.1+cpu
torchmetrics 1.9.0
tqdm 4.67.3
triton 2.3.1
typeguard 4.5.1
typer 0.24.1
typing_extensions 4.15.0
tzdata 2026.1
ujson 5.12.0
urllib3 2.6.3
uvicorn 0.30.0
uvloop 0.22.1
watchfiles 1.1.1
websockets 11.0.3
Werkzeug 3.1.8
WeTextProcessing 1.0.4.1
wget 3.2
wheel 0.45.1
xxhash 3.6.0
yapf 0.43.0
yarl 1.23.0
zipp 3.23.0
运行信息
(cosy_cann) python3 infer.py --model_path=CosyVoice2-0.5B --stream_out
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch/cuda/__init__.py:56: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
import pynvml # type: ignore[import]
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch_npu/utils/collect_env.py:59: UserWarning: Warning: The /usr/local/Ascend/ascend-toolkit/latest owner does not match the current owner.
warnings.warn(f"Warning: The {path} owner does not match the current owner.")
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch_npu/utils/collect_env.py:59: UserWarning: Warning: The /usr/local/Ascend/ascend-toolkit/8.2.RC2/x86_64-linux/ascend_toolkit_install.info owner does not match the current owner.
warnings.warn(f"Warning: The {path} owner does not match the current owner.")
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch_npu/contrib/transfer_to_npu.py:294: 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.Tensor.pin_memory, torch.nn.Module.to, torch.nn.Module.to_empty
*************************************************************************************************************
warnings.warn(msg, ImportWarning)
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch_npu/contrib/transfer_to_npu.py:249: 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)
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch_npu/dynamo/torchair/__init__.py:8: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/pkg_resources/__init__.py:3147: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
2026-04-07 15:49:18,775 - modelscope - INFO - PyTorch version 2.3.1+cpu Found.
2026-04-07 15:49:18,776 - modelscope - INFO - Loading ast index from /home/ds/.cache/modelscope/ast_indexer
2026-04-07 15:49:18,831 - modelscope - INFO - Loading done! Current index file version is 1.15.0, with md5 6aec0eb39b0ee6ed30f0f856f1761c23 and a total number of 980 components indexed
failed to import ttsfrd, use WeTextProcessing instead
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/lightning/fabric/__init__.py:41: Deprecated call to `pkg_resources.declare_namespace('lightning.fabric')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/pkg_resources/__init__.py:2559: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('lightning')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(parent)
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/matplotlib/_fontconfig_pattern.py:88: PyparsingDeprecationWarning: 'parseString' deprecated - use 'parse_string'
parse = parser.parseString(pattern)
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/matplotlib/_fontconfig_pattern.py:92: PyparsingDeprecationWarning: 'resetCache' deprecated - use 'reset_cache'
parser.resetCache()
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/matplotlib/_mathtext.py:30: PyparsingDeprecationWarning: 'enablePackrat' deprecated - use 'enable_packrat'
ParserElement.enablePackrat()
2026-04-07 15:49:26,291 WARNING In /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/matplotlib/mpl-data/stylelib/classic.mplstyle: 'parseString' deprecated - use 'parse_string'
2026-04-07 15:49:26,291 WARNING In /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/matplotlib/mpl-data/stylelib/classic.mplstyle: 'resetCache' deprecated - use 'reset_cache'
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/lightning/pytorch/__init__.py:37: Deprecated call to `pkg_resources.declare_namespace('lightning.pytorch')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/pkg_resources/__init__.py:2559: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('lightning')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(parent)
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/diffusers/models/lora.py:393: FutureWarning: `LoRACompatibleLinear` is deprecated and will be removed in version 1.0.0. Use of `LoRACompatibleLinear` is deprecated. Please switch to PEFT backend by installing PEFT: `pip install peft`.
deprecate("LoRACompatibleLinear", "1.0.0", deprecation_message)
2026-04-07 15:49:28,094 INFO input frame rate=25
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py:65: UserWarning: Specified provider 'CUDAExecutionProvider' is not in available provider names.Available providers: 'CPUExecutionProvider'
warnings.warn(
2026-04-07 15:49:37,131 WETEXT INFO building fst for zh_normalizer ...
2026-04-07 15:49:37,131 INFO building fst for zh_normalizer ...
2026-04-07 15:50:14,578 WETEXT INFO done
2026-04-07 15:50:14,578 INFO done
2026-04-07 15:50:14,578 WETEXT INFO fst path: /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/zh_tn_tagger.fst
2026-04-07 15:50:14,578 INFO fst path: /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/zh_tn_tagger.fst
2026-04-07 15:50:14,578 WETEXT INFO /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/zh_tn_verbalizer.fst
2026-04-07 15:50:14,578 INFO /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/zh_tn_verbalizer.fst
2026-04-07 15:50:14,583 WETEXT INFO found existing fst: /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/en_tn_tagger.fst
2026-04-07 15:50:14,583 INFO found existing fst: /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/en_tn_tagger.fst
2026-04-07 15:50:14,583 WETEXT INFO /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/en_tn_verbalizer.fst
2026-04-07 15:50:14,583 INFO /home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/tn/en_tn_verbalizer.fst
2026-04-07 15:50:14,583 WETEXT INFO skip building fst for en_normalizer ...
2026-04-07 15:50:14,583 INFO skip building fst for en_normalizer ...
[WARN] acl repeat initialize
[INFO] acl init success
[INFO] open device 0 success
[INFO] get current context
[INFO] load model CosyVoice2-0.5B/flow_linux_x86_64.om success
[INFO] create model description success
[INFO] create new context
[INFO] load model CosyVoice2-0.5B/flow_static.om success
[INFO] create model description success
[INFO] create new context
[INFO] load model CosyVoice2-0.5B/speech_linux_x86_64.om success
[INFO] create model description success
Removing weight norm...
warm up start
0%| | 0/1 [00:00<?, ?it/s]2026-04-07 15:51:02,249 INFO synthesis text 收到好友从远方寄来的生日礼物,那份意外的惊喜和深深的祝福,让我心中充满了甜蜜的快乐,笑容如花儿般绽放。
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch_npu/dynamo/torchair/_ge_concrete_graph/fx2ge_converter.py:954: UserWarning: When enable frozen_parameter, Parameters will be considered frozen.Please make sure that the Parameters data address remain the same throughout the program runtime.
warnings.warn(f'When enable frozen_parameter, Parameters will be considered frozen.'
...../home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch_npu/dynamo/torchair/_ge_concrete_graph/fx2ge_converter.py:954: UserWarning: When enable frozen_parameter, Parameters will be considered frozen.Please make sure that the Parameters data address remain the same throughout the program runtime.
warnings.warn(f'When enable frozen_parameter, Parameters will be considered frozen.'
0%| | 0/1 [02:52<?, ?it/s]
Traceback (most recent call last):
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/infer.py", line 118, in <module>
no_stream_input_inference(args, cosyvoice, prompt_txt)
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/infer.py", line 26, in no_stream_input_inference
for _ in enumerate(cosyvoice.inference_sft(prompt_txt[0], '中文女', stream=args.stream_out)):
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/cosyvoice/cli/cosyvoice.py", line 74, in inference_sft
for idx, model_output in enumerate(self.model.tts(**model_input, stream=stream, speed=speed)):
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/cosyvoice/cli/model.py", line 386, in tts
this_tts_speech = self.token2wav(token=this_tts_speech_token,
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/cosyvoice/cli/model.py", line 335, in token2wav
tts_mel, _ = self.flow.inference(token=token.to(self.device),
File "/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/cosyvoice/flow/flow.py", line 230, in inference
feat, _ = self.decoder(
File "/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ds/miniforge3/envs/cosy_cann/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/cosyvoice/flow/flow_matching.py", line 234, in forward
return self.solve_euler(z, t_span=t_span, mu=mu, mask=mask, spks=spks, cond=cond), None
File "/home/ds/sphtxt/cosy2/ModelZoo-PyTorch/ACL_PyTorch/built-in/audio/CosyVoice2/CosyVoice/cosyvoice/flow/flow_matching.py", line 116, in solve_euler
self.flow_om.set_context()
AttributeError: 'InferSession' object has no attribute 'set_context'
[ERROR] 2026-04-07-15:54:05 (PID:837388, Device:0, RankID:-1) ERR99999 UNKNOWN application exception
[INFO] unload model success, model Id is 2147483649
[INFO] unload model success, model Id is 2147483648
[INFO] unload model success, model Id is 2
[WARN] acl repeat destroy