You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Tutorial for using torch.compile with Stable Diffusion and
Torch-TensorRT
- Demonstration of output images without need to rerun the whole script
upon initial compilation of the docs
This interactive script is intended as a sample of the Torch-TensorRT workflow with `torch.compile` on a Stable Diffusion model. A sample output is featured below:
8
+
9
+
.. image:: /tutorials/images/majestic_castle.png
10
+
:width: 512px
11
+
:height: 512px
12
+
:scale: 50 %
13
+
:align: right
14
+
"""
15
+
16
+
# %%
17
+
# Imports and Model Definition
18
+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19
+
20
+
importtorch
21
+
fromdiffusersimportDiffusionPipeline
22
+
23
+
importtorch_tensorrt
24
+
25
+
model_id="CompVis/stable-diffusion-v1-4"
26
+
device="cuda:0"
27
+
28
+
# Instantiate Stable Diffusion Pipeline with FP16 weights
0 commit comments