CosyVoice icon indicating copy to clipboard operation
CosyVoice copied to clipboard

triton_trtllm 启动的cv3服务失败Note: Current Version: 239, Serialized Engine Version: 240)

Open zenghuiguan opened this issue 9 months ago • 5 comments

通过这个命令启动容器 https://github.com/FunAudioLLM/CosyVoice/blob/04bcadc6340e266b4ba09f4474b4668c444aa063/runtime/triton_trtllm/README.DIT.md?plain=1#L24,并运行 triton server, 发现环境中的 tensort 版本为 不是 10.13.3.9, 这样会导致生成的音频没有声音。

尝试通过命令pip install --upgrade tensorrt-cu12==10.13.3.9 --extra-index-url https://download.pytorch.org/whl/cu121升级 tensorrt 为 10.13.3.9,

然后重新生成 onnx/jit/engine/plan:

python3 cosyvoice/bin/export_jit.py --model_dir pretrained_models/Fun-CosyVoice3-0.5B
python3 cosyvoice/bin/export_onnx.py --model_dir pretrained_models/Fun-CosyVoice3-0.5B

python3 deployserver/tools/cosyvoice3/pretrained_to_huggingface.py \
    --model-dir $(pwd)/pretrained_models/Fun-CosyVoice3-0.5B \
    --output-dir $(pwd)/pretrained_models/Fun-CosyVoice3-0.5B/cosyvoice3_llm \
    --dtype bfloat16

python3 runtime/triton_trtllm/scripts/convert_checkpoint.py \
      --model_dir $(pwd)/pretrained_models/Fun-CosyVoice3-0.5B/cosyvoice3_llm \
      --output_dir ./cosyvoice3_llm-trt_weights_bfloat16 \
      --dtype bfloat16 || exit 1

trtllm-build --checkpoint_dir ./cosyvoice3_llm-trt_weights_bfloat16 \
            --output_dir $(pwd)/pretrained_models/Fun-CosyVoice3-0.5B/cosyvoice3_llm-trt_engines_bfloat16 \
            --max_batch_size 64 \
            --max_num_tokens 32768 \
            --gemm_plugin bfloat16 || exit 1

但是triton server 启动时会报如下错误:


[TensorRT-LLM][ERROR] IRuntime::deserializeCudaEngine: Error Code 1: Serialization (Serialization assertion stdVersionRead == kSERIALIZATION_VERSION failed.Version tag does not match. Note: Current Version: 239, Serialized Engine Version: 240)
[TensorRT-LLM][INFO] Engine load time 427 ms
E0212 09:54:09.950078 53505 backend_model.cc:694] "ERROR: Failed to create instance: unexpected error when creating modelInstanceState: [TensorRT-LLM][ERROR] Assertion failed: Failed to deserialize cuda engine. (/workspace/tensorrt_llm/cpp/tensorrt_llm/runtime/tllmRuntime.cpp:230)\n1       0x7fe5e3d6f341 tensorrt_llm::common::throwRuntimeError(char const*, int, char const*) + 97\n2       0x7fe5e3d8e156 /usr/local/lib/python3.12/dist-packages/tensorrt_llm/libs/libtensorrt_llm.so(+0x1d00156) [0x7fe5e3d8e156]\n3       0x7fe5e4dd8b19 tensorrt_llm::batch_manager::TrtGptModelInflightBatching::TrtGptModelInflightBatching(std::shared_ptr<nvinfer1::ILogger>, tensorrt_llm::runtime::ModelConfig const&, tensorrt_llm::runtime::WorldConfig const&, tensorrt_llm::runtime::RawEngine const&, bool, tensorrt_llm::batch_manager::TrtGptModelOptionalParams const&) + 1353\n4       0x7fe5e4ebc9cd tensorrt_llm::batch_manager::TrtGptModelFactory::create(tensorrt_llm::runtime::RawEngine const&, tensorrt_llm::runtime::ModelConfig const&, tensorrt_llm::runtime::WorldConfig const&, tensorrt_llm::batch_manager::TrtGptModelType, tensorrt_llm::batch_manager::TrtGptModelOptionalParams const&) + 1213\n5       0x7fe5e4ea6ed1 tensorrt_llm::executor::Executor::Impl::createModel(tensorrt_llm::runtime::RawEngine const&, tensorrt_llm::runtime::ModelConfig const&, tensorrt_llm::runtime::WorldConfig const&, tensorrt_llm::executor::ExecutorConfig const&) + 209\n6       0x7fe5e4ea7505 tensorrt_llm::executor::Executor::Impl::loadModel(std::optional<std::filesystem::__cxx11::path> const&, std::optional<std::basic_string_view<unsigned char, std::char_traits<unsigned char> > > const&, tensorrt_llm::runtime::GptJsonConfig const&, tensorrt_llm::executor::ExecutorConfig const&, bool, std::optional<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, tensorrt_llm::executor::Tensor, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, tensorrt_llm::executor::Tensor> > > > const&) + 1173\n7       0x7fe5e4ea87fa tensorrt_llm::executor::Executor::Impl::Impl(std::filesystem::__cxx11::path const&, std::optional<std::filesystem::__cxx11::path> const&, tensorrt_llm::executor::ModelType, tensorrt_llm::executor::ExecutorConfig const&) + 2474\n8       0x7fe5e4e8cff7 tensorrt_llm::executor::Executor::Executor(std::filesystem::__cxx11::path const&, tensorrt_llm::executor::ModelType, tensorrt_llm::executor::ExecutorConfig const&) + 87\n9       0x7fe6626d125e /opt/tritonserver/backends/tensorrtllm/libtriton_tensorrtllm.so(+0x3c25e) [0x7fe6626d125e]\n10      0x7fe6626ccdc1 triton::backend::inflight_batcher_llm::ModelInstanceState::ModelInstanceState(triton::backend::inflight_batcher_llm::ModelState*, TRITONBACKEND_ModelInstance*) + 1793\n11      0x7fe6626cd292 triton::backend::inflight_batcher_llm::ModelInstanceState::Create(triton::backend::inflight_batcher_llm::ModelState*, TRITONBACKEND_ModelInstance*, triton::backend::inflight_batcher_llm::ModelInstanceState**) + 66\n12      0x7fe6626b6b09 TRITONBACKEND_ModelInstanceInitialize + 153\n13      0x7fe6abdd6799 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x1a1799) [0x7fe6abdd6799]\n14      0x7fe6abdd7222 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x1a2222) [0x7fe6abdd7222]\n15      0x7fe6abdbce43 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x187e43) [0x7fe6abdbce43]\n16      0x7fe6abdbd1f4 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x1881f4) [0x7fe6abdbd1f4]\n17      0x7fe6abdc67dd /opt/tritonserver/bin/../lib/libtritonserver.so(+0x1917dd) [0x7fe6abdc67dd]\n18      0x7fe6ab333ed3 /lib/x86_64-linux-gnu/libc.so.6(+0xa1ed3) [0x7fe6ab333ed3]\n19      0x7fe6abdb4052 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x17f052) [0x7fe6abdb4052]\n20      0x7fe6abdc1f2c /opt/tritonserver/bin/../lib/libtritonserver.so(+0x18cf2c) [0x7fe6abdc1f2c]\n21      0x7fe6abdc5f62 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x190f62) [0x7fe6abdc5f62]\n22      0x7fe6abec75e1 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x2925e1) [0x7fe6abec75e1]\n23      0x7fe6abeca93c /opt/tritonserver/bin/../lib/libtritonserver.so(+0x29593c) [0x7fe6abeca93c]\n24      0x7fe6ac026e85 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x3f1e85) [0x7fe6ac026e85]\n25      0x7fe6ab590db4 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xecdb4) [0x7fe6ab590db4]\n26      0x7fe6ab32eaa4 /lib/x86_64-linux-gnu/libc.so.6(+0x9caa4) [0x7fe6ab32eaa4]\n27      0x7fe6ab3bba34 __clone + 68"
E0212 09:54:09.950267 53505 model_lifecycle.cc:654] "failed to load 'tensorrt_llm' version 1: Internal: unexpected error when creating modelInstanceState: [TensorRT-LLM][ERROR] Assertion failed: Failed to deserialize cuda engine. (/workspace/tensorrt_llm/cpp/tensorrt_llm/runtime/tllmRuntime.cpp:230)\n1       0x7fe5e3d6f341 tensorrt_llm::common::throwRuntimeError(char const*, int, char const*) + 97\n2       0x7fe5e3d8e156 /usr/local/lib/python3.12/dist-packages/tensorrt_llm/libs/libtensorrt_llm.so(+0x1d00156) [0x7fe5e3d8e156]\n3       0x7fe5e4dd8b19 tensorrt_llm::batch_manager::TrtGptModelInflightBatching::TrtGptModelInflightBatching(std::shared_ptr<nvinfer1::ILogger>, tensorrt_llm::runtime::ModelConfig const&, tensorrt_llm::runtime::WorldConfig const&, tensorrt_llm::runtime::RawEngine const&, bool, tensorrt_llm::batch_manager::TrtGptModelOptionalParams const&) + 1353\n4       0x7fe5e4ebc9cd tensorrt_llm::batch_manager::TrtGptModelFactory::create(tensorrt_llm::runtime::RawEngine const&, tensorrt_llm::runtime::ModelConfig const&, tensorrt_llm::runtime::WorldConfig const&, tensorrt_llm::batch_manager::TrtGptModelType, tensorrt_llm::batch_manager::TrtGptModelOptionalParams const&) + 1213\n5       0x7fe5e4ea6ed1 tensorrt_llm::executor::Executor::Impl::createModel(tensorrt_llm::runtime::RawEngine const&, tensorrt_llm::runtime::ModelConfig const&, tensorrt_llm::runtime::WorldConfig const&, tensorrt_llm::executor::ExecutorConfig const&) + 209\n6       0x7fe5e4ea7505 tensorrt_llm::executor::Executor::Impl::loadModel(std::optional<std::filesystem::__cxx11::path> const&, std::optional<std::basic_string_view<unsigned char, std::char_traits<unsigned char> > > const&, tensorrt_llm::runtime::GptJsonConfig const&, tensorrt_llm::executor::ExecutorConfig const&, bool, std::optional<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, tensorrt_llm::executor::Tensor, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, tensorrt_llm::executor::Tensor> > > > const&) + 1173\n7       0x7fe5e4ea87fa tensorrt_llm::executor::Executor::Impl::Impl(std::filesystem::__cxx11::path const&, std::optional<std::filesystem::__cxx11::path> const&, tensorrt_llm::executor::ModelType, tensorrt_llm::executor::ExecutorConfig const&) + 2474\n8       0x7fe5e4e8cff7 tensorrt_llm::executor::Executor::Executor(std::filesystem::__cxx11::path const&, tensorrt_llm::executor::ModelType, tensorrt_llm::executor::ExecutorConfig const&) + 87\n9       0x7fe6626d125e /opt/tritonserver/backends/tensorrtllm/libtriton_tensorrtllm.so(+0x3c25e) [0x7fe6626d125e]\n10      0x7fe6626ccdc1 triton::backend::inflight_batcher_llm::ModelInstanceState::ModelInstanceState(triton::backend::inflight_batcher_llm::ModelState*, TRITONBACKEND_ModelInstance*) + 1793\n11      0x7fe6626cd292 triton::backend::inflight_batcher_llm::ModelInstanceState::Create(triton::backend::inflight_batcher_llm::ModelState*, TRITONBACKEND_ModelInstance*, triton::backend::inflight_batcher_llm::ModelInstanceState**) + 66\n12      0x7fe6626b6b09 TRITONBACKEND_ModelInstanceInitialize + 153\n13      0x7fe6abdd6799 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x1a1799) [0x7fe6abdd6799]\n14      0x7fe6abdd7222 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x1a2222) [0x7fe6abdd7222]\n15      0x7fe6abdbce43 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x187e43) [0x7fe6abdbce43]\n16      0x7fe6abdbd1f4 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x1881f4) [0x7fe6abdbd1f4]\n17      0x7fe6abdc67dd /opt/tritonserver/bin/../lib/libtritonserver.so(+0x1917dd) [0x7fe6abdc67dd]\n18      0x7fe6ab333ed3 /lib/x86_64-linux-gnu/libc.so.6(+0xa1ed3) [0x7fe6ab333ed3]\n19      0x7fe6abdb4052 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x17f052) [0x7fe6abdb4052]\n20      0x7fe6abdc1f2c /opt/tritonserver/bin/../lib/libtritonserver.so(+0x18cf2c) [0x7fe6abdc1f2c]\n21      0x7fe6abdc5f62 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x190f62) [0x7fe6abdc5f62]\n22      0x7fe6abec75e1 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x2925e1) [0x7fe6abec75e1]\n23      0x7fe6abeca93c /opt/tritonserver/bin/../lib/libtritonserver.so(+0x29593c) [0x7fe6abeca93c]\n24      0x7fe6ac026e85 /opt/tritonserver/bin/../lib/libtritonserver.so(+0x3f1e85) [0x7fe6ac026e85]\n25      0x7fe6ab590db4 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xecdb4) [0x7fe6ab590db4]\n26      0x7fe6ab32eaa4 /lib/x86_64-linux-gnu/libc.so.6(+0x9caa4) [0x7fe6ab32eaa4]\n27      0x7fe6ab3bba34 __clone + 68"

我的环境信息如下:


root@88307ed25c21:/workspace/CosyVoice# nvidia-smi
Thu Feb 12 10:14:51 2026
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.154.05             Driver Version: 535.154.05   CUDA Version: 12.9     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA L20                     On  | 00000000:65:01.0 Off |                    0 |
| N/A   31C    P0              77W / 350W |  30412MiB / 46068MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
+---------------------------------------------------------------------------------------+
root@88307ed25c21:/workspace/CosyVoice# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2025 NVIDIA Corporation
Built on Wed_Apr__9_19:24:57_PDT_2025
Cuda compilation tools, release 12.9, V12.9.41
Build cuda_12.9.r12.9/compiler.35813241_0
root@88307ed25c21:/workspace/CosyVoice# pip list | grep -E "cuda|tensor|trans"
cuda-bindings            12.9.0
cuda-python              12.9.0
cupy-cuda12x             13.4.1
nvidia-cuda-nvrtc-cu12   12.9.86
nvidia-cuda-runtime-cu12 12.9.79
safetensors              0.5.3
tensorrt                 10.10.0.31
tensorrt-cu12            10.13.3.9
tensorrt_cu12_bindings   10.13.3.9
tensorrt_cu12_libs       10.13.3.9
tensorrt_llm             0.20.0
transformers             4.51.3
x-transformers           2.11.24
root@88307ed25c21:/workspace/CosyVoice#

zenghuiguan avatar Feb 12 '26 10:02 zenghuiguan

同样的流程,在 L40s 上没有问题,在 L20 上会有上面的问题

zenghuiguan avatar Feb 12 '26 10:02 zenghuiguan

@yuekaizhang 麻烦请教一下,您有在10.13.3.9 版本下运行过 in4 的量化吗?

zenghuiguan avatar Feb 12 '26 14:02 zenghuiguan

@zenghuiguan 可能是 tritonserver 默认的 tensorrt bin 路径和 你新安装的 10.13.3.9 bin 路径不同导致的。可以 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:// 试试

yuekaizhang avatar Mar 10 '26 11:03 yuekaizhang

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Apr 10 '26 02:04 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Apr 26 '26 02:04 github-actions[bot]