code: def main():
      """
      ### CLI
      """
      parser = argparse.ArgumentParser()
  
      parser.add_argument(
          "--prompt",
          type=str,
          nargs="?",
          default="a painting of a virus monster playing guitar",
          help="the prompt to render",
      )
  
      parser.add_argument(
          "--batch_size", type=int, default=4, help="batch size"
      )
  
      parser.add_argument(
          "--sampler",
          dest="sampler_name",
          choices=["ddim", "ddpm"],
          default="ddim",
          help=f"Set the sampler.",
      )
  
      parser.add_argument(
          "--flash",
          action="store_true",
          help="whether to use flash attention",
      )
  
      parser.add_argument(
          "--steps",
          type=int,
          default=50,
          help="number of sampling steps",
      )
  
      parser.add_argument(
          "--scale",
          type=float,
          default=7.5,
          help="unconditional guidance scale: "
          "eps = eps(x, empty) + scale * (eps(x, cond) - eps(x, empty))",
      )
  
      opt = parser.parse_args()
  
      set_seed(42)
  
      # Set flash attention
      from labml_nn.diffusion.stable_diffusion.model.unet_attention import (
          CrossAttention,
      )
  
      CrossAttention.use_flash_attention = opt.flash
  
      #
      txt2img = Txt2Img(
          checkpoint_path=lab.get_data_path()
          / "stable-diffusion"
          / "sd-v1-4.ckpt",
          sampler_name=opt.sampler_name,
          n_steps=opt.steps,
      )
  
      with monit.section("Generate"):
          txt2img(
              dest_path="outputs",
              batch_size=opt.batch_size,
              prompt=opt.prompt,
              uncond_scale=opt.scale,
          )
  
file_path: annotated_deep_learning_paper_implementations/labml_nn/diffusion/stable_diffusion/scripts/text_to_image.py
imports: import argparse
  import os
  from pathlib import Path
  import torch
  from labml import lab, monit
  from labml_nn.diffusion.stable_diffusion.latent_diffusion import LatentDiffusion
  from labml_nn.diffusion.stable_diffusion.sampler.ddim import DDIMSampler
  from labml_nn.diffusion.stable_diffusion.sampler.ddpm import DDPMSampler
  from labml_nn.diffusion.stable_diffusion.util import load_model, save_images, set_seed
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types