English
Jarvis73 commited on
Commit
a542584
·
verified ·
1 Parent(s): 802781f

Upload ./README_zh.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README_zh.md +21 -12
README_zh.md CHANGED
@@ -1,11 +1,19 @@
1
  # 混元-DiT TensorRT 加速
2
 
3
- [English](https://huggingface.co/Tencent-Hunyuan/TensorRT-libs/blob/main/README.md) | 中文
4
 
5
  我们提供了将 [混元-DiT](https://github.com/Tencent/HunyuanDiT) 中的文生图模型转换为 TensorRT 的代码和相关依赖用于推理加速
6
- (比 Flash Attention 更快)。 您可以使用以下步骤使用我们 TensorRT 模型。
7
 
8
- ## 1. Huggingface 下载 TensorRT 的依赖文件
 
 
 
 
 
 
 
 
9
 
10
  ```shell
11
  cd HunyuanDiT
@@ -14,15 +22,15 @@ cd HunyuanDiT
14
  huggingface-cli download Tencent-Hunyuan/TensorRT-libs --local-dir ./ckpts/t2i/model_trt
15
  ```
16
 
17
- ## 2. 安装 TensorRT 依赖
18
 
19
  ```shell
20
  sh trt/install.sh
21
  ```
22
 
23
- ## 3. 构建 TensorRT engine
24
 
25
- ### 方法1: 使用预构建的 engine
26
 
27
  本仓库提供了一些预构建的 TensorRT engine.
28
 
@@ -38,21 +46,18 @@ sh trt/install.sh
38
  huggingface-cli download Tencent-Hunyuan/TensorRT-engine <远程地址> --local-dir ./ckpts/t2i/model_trt/engine
39
  ```
40
 
41
- ### 方法2: 自行构建 engine
42
  如果您使用不同于上面表格中的 GPU, 可以使用以下命令构建适配于当前 GPU 的 engine.
43
 
44
  ```shell
45
  # 首先设置 TensorRT 构建相关的环境变量,我们提供了一个脚本来一键设置
46
  source trt/activate.sh
47
 
48
- # 方式1: 构建 TensorRT engine. 默认会读取当前目录下的 ckpts 文件夹
49
  sh trt/build_engine.sh
50
-
51
- # 方式2: 如果您的模型目录不是 ckpts, 需要指定模型目录
52
- sh trt/build_engine.sh </path/to/ckpts>
53
  ```
54
 
55
- 4. 使用 TensorRT 模型进行推理.
56
 
57
  ```shell
58
  # 使用 prompt 强化 + 文生图 TensorRT 模型进行推理
@@ -61,3 +66,7 @@ python sample_t2i.py --prompt "渔舟唱晚" --infer-mode trt
61
  # 关闭 prompt 强化 (可以在显存不足时使用)
62
  python sample_t2i.py --prompt "渔舟唱晚" --infer-mode trt --no-enhance
63
  ```
 
 
 
 
 
1
  # 混元-DiT TensorRT 加速
2
 
3
+ 语言: [**English**](https://huggingface.co/Tencent-Hunyuan/TensorRT-libs/blob/main/README.md) | **中文**
4
 
5
  我们提供了将 [混元-DiT](https://github.com/Tencent/HunyuanDiT) 中的文生图模型转换为 TensorRT 的代码和相关依赖用于推理加速
6
+ (比 Flash Attention 更快). 您可以使用以下步骤使用我们 TensorRT 模型, 基于 **TensorRT-9.2.0.5** 和 **cuda (11.7 或 11.8)**.
7
 
8
+ > ⚠️ **重要提醒 (关于TensorRT加速版本测试的建议)**:
9
+ > 我们建议用户在 Compute Capability>=8.0 的 NVIDIA 显卡上测试 TensorRT 版本, (例如, RTX4090, RTX3090, H800, A10/A100/A800 等)
10
+ > 您可以从[这里](https://developer.nvidia.com/cuda-gpus#compute)查询到您显卡对应的 Compute Capability。
11
+ > 对于 Compute Capability<8.0 的 NVIDIA 显卡,如果您要尝试 TensorRT 版本,有可能遭遇 TensorRT Engine 文件无法生成的错误或推理性能较差
12
+ > 的问题,主要原因在于 TensorRT 没有在该架构上支持 fused mha kernel。
13
+
14
+ ## 🛠 构建步骤
15
+
16
+ ### 1. 从 Huggingface 下载 TensorRT 的依赖文件
17
 
18
  ```shell
19
  cd HunyuanDiT
 
22
  huggingface-cli download Tencent-Hunyuan/TensorRT-libs --local-dir ./ckpts/t2i/model_trt
23
  ```
24
 
25
+ ### 2. 安装 TensorRT 依赖
26
 
27
  ```shell
28
  sh trt/install.sh
29
  ```
30
 
31
+ ### 3. 构建 TensorRT engine
32
 
33
+ #### 方法1: 使用预构建的 engine
34
 
35
  本仓库提供了一些预构建的 TensorRT engine.
36
 
 
46
  huggingface-cli download Tencent-Hunyuan/TensorRT-engine <远程地址> --local-dir ./ckpts/t2i/model_trt/engine
47
  ```
48
 
49
+ #### 方法2: 自行构建 engine
50
  如果您使用不同于上面表格中的 GPU, 可以使用以下命令构建适配于当前 GPU 的 engine.
51
 
52
  ```shell
53
  # 首先设置 TensorRT 构建相关的环境变量,我们提供了一个脚本来一键设置
54
  source trt/activate.sh
55
 
56
+ # 构建 TensorRT engine. 默认会读取当前目录下的 ckpts 文件夹
57
  sh trt/build_engine.sh
 
 
 
58
  ```
59
 
60
+ ### 4. 使用 TensorRT 模型进行推理.
61
 
62
  ```shell
63
  # 使用 prompt 强化 + 文生图 TensorRT 模型进行推理
 
66
  # 关闭 prompt 强化 (可以在显存不足时使用)
67
  python sample_t2i.py --prompt "渔舟唱晚" --infer-mode trt --no-enhance
68
  ```
69
+
70
+ ## ❓ Q&A
71
+
72
+ 参考 [Q&A](./QA.md) 获取更多关于构建 TensorRT Engine 的问题解答.