"sunxi-cortexa53/info.md" did not exist on "7a6c8a5cdc012e5ee0910776da0f765e59a5c654"
build_trtllm_wheel.sh 2.26 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash -e
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

17
# Build the TRT-LLM wheel.
18
19
20

# This script builds the TRT-LLM base image for Dynamo with TensorRT-LLM.

21
while getopts "c:o:a:" opt; do
22
23
  case ${opt} in
    c) TRTLLM_COMMIT=$OPTARG ;;
24
25
26
27
28
29
30
    o) OUTPUT_DIR=$OPTARG ;;
    a) ARCH=$OPTARG ;;
    *) echo "Usage: $(basename $0) [-c commit] [-o output_dir] [-a arch]"
       echo "  -c: TensorRT-LLM commit to build"
       echo "  -o: Output directory for wheel files"
       echo "  -a: Architecture (amd64 or arm64)"
       exit 1 ;;
31
32
33
  esac
done

34
35
36
37
# Set default output directory if not specified
if [ -z "$OUTPUT_DIR" ]; then
    OUTPUT_DIR="/tmp/trtllm_wheel"
fi
38
39


40
41
42
(cd /tmp && \
# Clone the TensorRT-LLM repository.
if [ ! -d "TensorRT-LLM" ]; then
43
  git clone --single-branch --branch main https://github.com/NVIDIA/TensorRT-LLM.git
44
45
46
47
48
fi

cd TensorRT-LLM

# Checkout the specified commit.
49
50
51
# Switch to the main branch to pull the latest changes.
git checkout main
git pull
52
53
54
55
56
57
58
git checkout $TRTLLM_COMMIT

# Update the submodules.
git submodule update --init --recursive
git lfs pull

# Build the TRT-LLM base image.
59
60
61
62
63
64
65
66
67
68
make -C docker wheel_build

# Copy the wheel to the host
mkdir -p $OUTPUT_DIR

docker create --name trtllm_wheel_container docker.io/tensorrt_llm/wheel:latest
docker cp trtllm_wheel_container:/src/tensorrt_llm/build $OUTPUT_DIR/
cp $OUTPUT_DIR/build/*.whl $OUTPUT_DIR/
docker rm trtllm_wheel_container || true
)
69

70
71
72
# Store the commit hash in the output directory to ensure the wheel is built from the correct commit.
rm -rf $OUTPUT_DIR/commit.txt
echo ${ARCH}_${TRTLLM_COMMIT} > $OUTPUT_DIR/commit.txt
73

74
75
echo "TRT-LLM wheel built successfully."
ls -al $OUTPUT_DIR