Upload ./README.md with huggingface_hub
Browse files7 unmodified lines89101112131415161718191 unmodified line212223242526272829303132333435369 unmodified lines464748495051521 unmodified line54555657585960616263646566673 unmodified lines7172737 unmodified lines# HunyuanDiT TensorRT AccelerationEnglish | [中文](https://huggingface.co/Tencent-Hunyuan/TensorRT-libs/blob/main/README_zh.md)We provide a TensorRT version of [HunyuanDiT](https://github.com/Tencent/HunyuanDiT) for inference acceleration(faster than flash attention). One can convert the torch model to TensorRT model using the following steps.## 1. Download dependencies from huggingface.```shellcd HunyuanDiT1 unmodified linehuggingface-cli download Tencent-Hunyuan/TensorRT-libs --local-dir ./ckpts/t2i/model_trt```## 2. Install the TensorRT dependencies.```shellsh trt/install.sh```## 3. Build the TensorRT engine.### Method 1: Use the prebuilt engineWe provide some prebuilt TensorRT engines.9 unmodified lineshuggingface-cli download Tencent-Hunyuan/TensorRT-engine <Remote Path> --local-dir ./ckpts/t2i/model_trt/engine```### Method 2: Build your own engineIf you are using a different GPU, you can build the engine using the following command.1 unmodified line# Set the TensorRT build environment variables first. We provide a script to set up the environment.source trt/activate.sh# Method 1: Build the TensorRT engine. By default, it will read the `ckpts` folder in the current directory.sh trt/build_engine.sh# Method 2: If your model directory is not `ckpts`, you need to specify the model directory.sh trt/build_engine.sh </path/to/ckpts>```4. Run the inference using the TensorRT model.```shell# Run the inference using the prompt-enhanced model + HunyuanDiT TensorRT model.3 unmodified linespython sample_t2i.py --prompt "渔舟唱晚" --infer-mode trt --no-enhance```7 unmodified lines8910111213141516171819202122232425262728291 unmodified line313233343536373839404142434445469 unmodified lines565758596061621 unmodified line646566676869707172737475763 unmodified lines808182838485867 unmodified lines# HunyuanDiT TensorRT AccelerationLanguage: **English** | [**中文**](https://huggingface.co/Tencent-Hunyuan/TensorRT-libs/blob/main/README_zh.md)We provide a TensorRT version of [HunyuanDiT](https://github.com/Tencent/HunyuanDiT) for inference acceleration(faster than flash attention). One can convert the torch model to TensorRT model using the following steps based on**TensorRT-9.2.0.5** and **cuda (11.7 or 11.8)**.> ⚠️ Important Reminder (Suggestion for testing the TensorRT acceleration version):> We recommend users to test the TensorRT version on NVIDIA GPUs with Compute Capability >= 8.0,(For example, RTX4090,> RTX3090, H800, A10/A100/A800, etc.) you can query the Compute Capability corresponding to your GPU from> [here](https://developer.nvidia.com/cuda-gpus#compute). For NVIDIA GPUs with Compute Capability < 8.0, if you want to> try the TensorRT version, you may encounter errors that the TensorRT Engine file cannot be generated or the inference> performance is poor, the main reason is that TensorRT does not support fused mha kernel on this architecture.## 🛠 Instructions### 1. Download dependencies from huggingface.```shellcd HunyuanDiT1 unmodified linehuggingface-cli download Tencent-Hunyuan/TensorRT-libs --local-dir ./ckpts/t2i/model_trt```### 2. Install the TensorRT dependencies.```shellsh trt/install.sh```### 3. Build the TensorRT engine.#### Method 1: Use the prebuilt engineWe provide some prebuilt TensorRT engines.9 unmodified lineshuggingface-cli download Tencent-Hunyuan/TensorRT-engine <Remote Path> --local-dir ./ckpts/t2i/model_trt/engine```#### Method 2: Build your own engineIf you are using a different GPU, you can build the engine using the following command.1 unmodified line# Set the TensorRT build environment variables first. We provide a script to set up the environment.source trt/activate.sh# Build the TensorRT engine. By default, it will read the `ckpts` folder in the current directory.sh trt/build_engine.sh```Finally, if you see the output like `&&&& PASSED TensorRT.trtexec [TensorRT v9200]`, the engine is built successfully.### 4. Run the inference using the TensorRT model.```shell# Run the inference using the prompt-enhanced model + HunyuanDiT TensorRT model.3 unmodified linespython sample_t2i.py --prompt "渔舟唱晚" --infer-mode trt --no-enhance```## ❓ Q&APlease refer to the [Q&A](./QA.md) for more questions and answers about building the TensorRT Engine.
README.md+25-12