u want to learn more about how the training loop works, check out the Understanding pipelines, models and schedulers tutorial which breaks down the basic pattern of the denoising process.
</hfoption>
<hfoption id="decoder model">
The main() function contains the code for preparing the dataset and training the model. Unlike the prior model, the decoder initializes a VQModel to decode the latents into images and it uses a UNet2DConditionModel:   