code: def main(inference_config):
      if inference_config.get("infer"):
          # invoking from launcher
          trainer = Trainer(**inference_config.trainer)
          inference_config = inference_config.infer
      else:
          trainer = Trainer()
      inference_config: ImagenPipelineConfig = OmegaConf.merge(
          ImagenPipelineConfig(), inference_config
      )
      pipeline = ImagenPipeline.from_pretrained(
          cfg=inference_config, trainer=trainer
      )
  
      # Texts are passed in the config files
      images, all_res, throughput = pipeline()
  
      # Save images
      outpath = inference_config.output_path
      os.makedirs(outpath, exist_ok=True)
      for text, pils in zip(inference_config.texts, images):
          for idx, image in enumerate(pils):
              image.save(os.path.join(outpath, f"{text}_{idx}.png"))
  
imports: import os
  from omegaconf import OmegaConf
  from pytorch_lightning import Trainer
  from nemo.collections.multimodal.models.text_to_image.imagen.imagen_pipeline import ImagenPipeline, ImagenPipelineConfig
  from nemo.core.config import hydra_runner
label_desc: Use image node_id 1 for calling a global function with example usage: main(inference_config) without return types