返回 F5-TTS
export_vocos_trt.sh
根目录 / src / f5_tts / runtime / triton_trtllm / scripts / export_vocos_trt.sh
1 #!/bin/bash
2 # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 # Manual installation of TensorRT, in case not using NVIDIA NGC:
17 # https://docs.nvidia.com/deeplearning/tensorrt/latest/installing-tensorrt/installing.html#downloading-tensorrt
18 TRTEXEC="/usr/src/tensorrt/bin/trtexec"
19
20 ONNX_PATH=$1
21 ENGINE_PATH=$2
22 echo "ONNX_PATH: $ONNX_PATH"
23 echo "ENGINE_PATH: $ENGINE_PATH"
24 PRECISION="fp32"
25
26
27 MIN_BATCH_SIZE=1
28 OPT_BATCH_SIZE=1
29 MAX_BATCH_SIZE=8
30
31 MIN_INPUT_LENGTH=1
32 OPT_INPUT_LENGTH=1000
33 MAX_INPUT_LENGTH=3000 # 4096
34
35 MEL_MIN_SHAPE="${MIN_BATCH_SIZE}x100x${MIN_INPUT_LENGTH}"
36 MEL_OPT_SHAPE="${OPT_BATCH_SIZE}x100x${OPT_INPUT_LENGTH}"
37 MEL_MAX_SHAPE="${MAX_BATCH_SIZE}x100x${MAX_INPUT_LENGTH}"
38
39 ${TRTEXEC} \
40 --minShapes="mel:${MEL_MIN_SHAPE}" \
41 --optShapes="mel:${MEL_OPT_SHAPE}" \
42 --maxShapes="mel:${MEL_MAX_SHAPE}" \
43 --onnx=${ONNX_PATH} \
44 --saveEngine=${ENGINE_PATH}
45
45 lines BASH