code: def sample(
      model,
      sampler,
      prompt="A lush garden with oversized flowers and vibrant colors, inhabited by miniature animals.",
      H=1024,
      W=1024,
      seed=0,
      filter=None,
  ):
      F = 8
      C = 4
      shape = (1, C, H // F, W // F)
  
      value_dict = init_embedder_options(
          keys=get_unique_embedder_keys_from_conditioner(
              model.conditioner
          ),
          init_dict={
              "orig_width": W,
              "orig_height": H,
              "target_width": W,
              "target_height": H,
          },
          prompt=prompt,
      )
  
      if seed is None:
          seed = torch.seed()
      precision_scope = autocast
      with torch.no_grad():
          with precision_scope("cuda"):
              batch, batch_uc = get_batch(
                  get_unique_embedder_keys_from_conditioner(
                      model.conditioner
                  ),
                  value_dict,
                  [1],
              )
              c = model.conditioner(batch)
              uc = None
              randn = seeded_randn(shape, seed)
  
              def denoiser(input, sigma, c):
                  return model.denoiser(
                      model.model,
                      input,
                      sigma,
                      c,
                  )
  
              samples_z = sampler(denoiser, randn, cond=c, uc=uc)
              samples_x = model.decode_first_stage(samples_z)
              samples = torch.clamp(
                  (samples_x + 1.0) / 2.0, min=0.0, max=1.0
              )
              if filter is not None:
                  samples = filter(samples)
              samples = (
                  (255 * samples)
                  .to(dtype=torch.uint8)
                  .permute(0, 2, 3, 1)
                  .detach()
                  .cpu()
                  .numpy()
              )
      return samples
  
file_path: generative-models/scripts/demo/turbo.py
imports: from streamlit_helpers import *
  from st_keyup import st_keyup
  from sgm.modules.diffusionmodules.sampling import EulerAncestralSampler
label_desc: Use image node_id 3 for calling a global function with example usage: sample(model, sampler, prompt, H, W, seed, filter) and returns: samples, model