code: def load_all_models(diffusion_model, use_secondary_model):
      from .model.script_util import (
          model_and_diffusion_defaults,
      )
  
      model_config = model_and_diffusion_defaults()
  
      if diffusion_model == "512x512_diffusion_uncond_finetune_008100":
          model_config.update(
              {
                  "attention_resolutions": "32, 16, 8",
                  "class_cond": False,
                  "diffusion_steps": 1000,  # No need to edit this, it is taken care of later.
                  "rescale_timesteps": True,
                  "timestep_respacing": 250,  # No need to edit this, it is taken care of later.
                  "image_size": 512,
                  "learn_sigma": True,
                  "noise_schedule": "linear",
                  "num_channels": 256,
                  "num_head_channels": 64,
                  "num_res_blocks": 2,
                  "resblock_updown": True,
                  "use_fp16": False,
                  "use_scale_shift_norm": True,
              }
          )
      elif diffusion_model == "256x256_diffusion_uncond":
          model_config.update(
              {
                  "attention_resolutions": "32, 16, 8",
                  "class_cond": False,
                  "diffusion_steps": 1000,  # No need to edit this, it is taken care of later.
                  "rescale_timesteps": True,
                  "timestep_respacing": 250,  # No need to edit this, it is taken care of later.
                  "image_size": 256,
                  "learn_sigma": True,
                  "noise_schedule": "linear",
                  "num_channels": 256,
                  "num_head_channels": 64,
                  "num_res_blocks": 2,
                  "resblock_updown": True,
                  "use_fp16": False,
                  "use_scale_shift_norm": True,
              }
          )
  
      secondary_model = None
      if use_secondary_model:
          from .model.sec_diff import SecondaryDiffusionImageNet2
  
          secondary_model = SecondaryDiffusionImageNet2()
          model_dict = paddle.load(
              os.path.join(
                  os.path.dirname(__file__),
                  "pre_trained",
                  "secondary_model_imagenet_2.pdparams",
              )
          )
          secondary_model.set_state_dict(model_dict)
          secondary_model.eval()
          for parameter in secondary_model.parameters():
              parameter.stop_gradient = True
  
      return model_config, secondary_model
  
file_path: PaddleHub/modules/image/text_to_image/disco_diffusion_ernievil_base/reverse_diffusion/helper.py
imports: import hashlib
  import logging
  import os
  import subprocess
  import sys
  from os.path import expanduser
  from pathlib import Path
  from typing import Any
  from typing import Dict
  from typing import List
  import paddle
label_desc: Use image node_id 3 for calling a global function with example usage: load_all_models(diffusion_model, use_secondary_model) and returns: model_config,  secondary_model