本文主要是介绍【深度学习】SDXL tensorRT 推理,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
stabilityai/stable-diffusion-xl-1.0-tensorrt
项目:https://huggingface.co/stabilityai/stable-diffusion-xl-1.0-tensorrt
TensorRT环境:
git clone https://github.com/rajeevsrao/TensorRT.git
cd TensorRT
git checkout release/9.2
stabilityai/stable-diffusion-xl-1.0-tensorrt项目
git lfs install
git clone https://huggingface.co/stabilityai/stable-diffusion-xl-1.0-tensorrt
cd stable-diffusion-xl-1.0-tensorrt
git lfs pull
cd ..
进入容器:
docker run -it --gpus all -v $PWD:/workspace nvcr.io/nvidia/pytorch:23.11-py3 /bin/bash
安装环境:
cd demo/Diffusion
python3 -m pip install --upgrade pip
pip3 install -r requirements.txt
python3 -m pip install --pre --upgrade --extra-index-url https://pypi.nvidia.com tensorrt
执行SDXL推理:
python3 demo_txt2img_xl.py "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" --build-static-batch --use-cuda-graph --num-warmup-runs 1 --width 1024 --height 1024 --denoising-steps 30 --version=xl-1.0 --onnx-dir /workspace/stable-diffusion-xl-1.0-tensorrt/sdxl-1.0-base --onnx-refiner-dir /workspace/stable-diffusion-xl-1.0-tensorrt/sdxl-1.0-refiner
3090速度:
SDXL-LCM
python3 demo_txt2img_xl.py \"Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" \--version=xl-1.0 \--onnx-dir /workspace/stable-diffusion-xl-1.0-tensorrt/lcm \--engine-dir /workspace/stable-diffusion-xl-1.0-tensorrt/lcm/engine-sdxl-lcm-nocfg \--scheduler LCM \--denoising-steps 4 \--guidance-scale 0.0 \--seed 42
SDXL-LCMLORA
python3 demo_txt2img_xl.py \"Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" \--version=xl-1.0 \--onnx-dir /workspace/stable-diffusion-xl-1.0-tensorrt/lcmlora \--engine-dir /workspace/stable-diffusion-xl-1.0-tensorrt/lcm/engine-sdxl-lcmlora-nocfg \--scheduler LCM \--lora-path latent-consistency/lcm-lora-sdxl \--lora-scale 1.0 \--denoising-steps 4 \--guidance-scale 0.0 \--seed 42
3090速度:
这篇关于【深度学习】SDXL tensorRT 推理的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!