he model’s layers so that an executable or ScriptFunction is returned that will be optimized using just-in-time compilation.
To trace our UNet model, we can use the following:


	Copied
import time
import torch
from diffusers import StableDiffusionPipeline
import functools

# torch disable grad
torch.set_grad_enabled(False)

# set variables
n_experiments = 2
unet_runs_per_experiment = 50


# load inputs
def generate_inputs():
    sample = torch