背景
- 之前比赛项目里面的TensorRT-LLM是7月份的,最新版是10月份的,需要做版本升级,所以记录一下相关操作。
- 初赛介绍:https://tianchi.aliyun.com/competition/entrance/532108/information
- 复赛介绍:https://github.com/NVIDIA/trt-samples-for-hackathon-cn/tree/master/Hackathon2023
- 我的仓库:https://github.com/Tlntin/Qwen-7B-Chat-TensorRT-LLM
前置操作。
- 创建一个新分支,然后切换过去(可选)
git branch release/0.5.0
git checkout release/0.5.0
- 将原来的整个项目,除readme/images以及examples/qwen保留外,其他的都删除。
- 克隆官方TensorRT-LLM源码,默认是realse/0.5分支
git clone git@github.com:NVIDIA/TensorRT-LLM.git
cd TensorRT-LLM
git lfs install
git lfs pull
- 查看官方TensorRT-LLM仓库的子模块信息(待会能用上)
git submodule
# 输出结果
a1ceb0677f67371ed29a2b1c022794f077db5fe7 3rdparty/NVTX (v3.1.0-c-cpp)
fc9ebc645b63f3a6bc80aaefde5c063fb72110d6 3rdparty/cutlass (v2.10.0)
eb787304d67ec22f7c3a184ee8b4c481d04357fd 3rdparty/cxxopts (v3.1.1)
5fec8034933ef434a98dfbd2551b052c56345869 3rdparty/json (v3.11.2-62-g5fec8034)
- 查看官方TensorRT-LLM仓库的lfs大文件信息(待会能用上)
git lfs ls-files
# 输出结果
1f16865785 * cpp/tensorrt_llm/batch_manager/aarch64-linux-gnu/libtensorrt_llm_batch_manager_static.a
108ecbad13 * cpp/tensorrt_llm/batch_manager/aarch64-linux-gnu/libtensorrt_llm_batch_manager_static.pre_cxx11.a
179091b777 * cpp/tensorrt_llm/batch_manager/x86_64-linux-gnu/libtensorrt_llm_batch_manager_static.a
4c00eb2685 * cpp/tensorrt_llm/batch_manager/x86_64-linux-gnu/libtensorrt_llm_batch_manager_static.pre_cxx11.a
- 将整个TensorRT-LLM项目copy到你的项目(注意readme/lisence重命名一下,不要覆盖你的项目了)
- 将3rdparty目录下面的文件夹删除,待会需要重新注册
注册第三方子模块
git submodule add https://github.com/NVIDIA/NVTX.git 3rdparty/NVTX
git submodule add https://github.com/NVIDIA/cutlass.git 3rdparty/cutlass
git submodule add https://github.com/jarro2783/cxxopts 3rdparty/cxxopts
git submodule add https://github.com/nlohmann/json.git 3rdparty/json
指定第三方子模块的commit id
- NVTX
cd 3rdparty/NVTX
git checkout a1ceb0677f67371ed29a2b1c022794f077db5fe7
cd ../..
- cutlass
cd 3rdparty/cutlass
git checkout fc9ebc645b63f3a6bc80aaefde5c063fb72110d6
cd ../..
- cxxopts
cd 3rdparty/cxxopts
git checkout eb787304d67ec22f7c3a184ee8b4c481d04357fd
cd ../..
- json
cd 3rdparty/json
git checkout 5fec8034933ef434a98dfbd2551b052c56345869
cd ../..
查看最终子模块状态
git submodule
# 输出结果
a1ceb0677f67371ed29a2b1c022794f077db5fe7 3rdparty/NVTX (v3.1.0-c-cpp)
fc9ebc645b63f3a6bc80aaefde5c063fb72110d6 3rdparty/cutlass (v2.10.0)
eb787304d67ec22f7c3a184ee8b4c481d04357fd 3rdparty/cxxopts (v3.1.1)
5fec8034933ef434a98dfbd2551b052c56345869 3rdparty/json (v3.11.2-62-g5fec8034)
添加lfs文件
- 安装git-lfs
apt install git-lfs
- 初始化lfs
git lfs install
- 添加需要上传的lfs文件
git lfs track cpp/tensorrt_llm/batch_manager/aarch64-linux-gnu/libtensorrt_llm_batch_manager_static.a
git lfs track cpp/tensorrt_llm/batch_manager/aarch64-linux-gnu/libtensorrt_llm_batch_manager_static.pre_cxx11.a
git lfs track cpp/tensorrt_llm/batch_manager/x86_64-linux-gnu/libtensorrt_llm_batch_manager_static.a
git lfs track cpp/tensorrt_llm/batch_manager/x86_64-linux-gnu/libtensorrt_llm_batch_manager_static.pre_cxx11.a
- 此时可以看到仓库根目录有一个
.gitattributes
文件,里面有存lfs相关信息 - 上传仓库
git add .
git commit -m ""
git push -u origin release/0.5.0 --tag
- 查看lfs文件状态
git lfs ls-files
# 输出结果
1f16865785 * cpp/tensorrt_llm/batch_manager/aarch64-linux-gnu/libtensorrt_llm_batch_manager_static.a
108ecbad13 * cpp/tensorrt_llm/batch_manager/aarch64-linux-gnu/libtensorrt_llm_batch_manager_static.pre_cxx11.a
179091b777 * cpp/tensorrt_llm/batch_manager/x86_64-linux-gnu/libtensorrt_llm_batch_manager_static.a
4c00eb2685 * cpp/tensorrt_llm/batch_manager/x86_64-linux-gnu/libtensorrt_llm_batch_manager_static.pre_cxx11.a
注:上述只是升级了TensorRT-LLM的版本,但是由于7月份和10月份接口变动较大,还需要进一步对接。