code: def load_pretrained_model(model, pretrained_model):
      if pretrained_model is not None:
          logger.info(
              "Loading pretrained model from {}".format(
                  pretrained_model
              )
          )
  
          if urlparse(pretrained_model).netloc:
              pretrained_model = download_pretrained_model(
                  pretrained_model
              )
  
          if os.path.exists(pretrained_model):
              para_state_dict = paddle.load(pretrained_model)
  
              model_state_dict = model.state_dict()
              keys = model_state_dict.keys()
              num_params_loaded = 0
              for k in keys:
                  if k not in para_state_dict:
                      logger.warning(
                          "{} is not in pretrained model".format(k)
                      )
                  elif list(para_state_dict[k].shape) != list(
                      model_state_dict[k].shape
                  ):
                      logger.warning(
                          "[SKIP] Shape of pretrained params {} doesn't match.(Pretrained: {}, Actual: {})".format(
                              k,
                              para_state_dict[k].shape,
                              model_state_dict[k].shape,
                          )
                      )
                  else:
                      model_state_dict[k] = para_state_dict[k]
                      num_params_loaded += 1
              model.set_dict(model_state_dict)
              logger.info(
                  "There are {}/{} variables loaded into {}.".format(
                      num_params_loaded,
                      len(model_state_dict),
                      model.__class__.__name__,
                  )
              )
  
          else:
              raise ValueError(
                  "The pretrained model directory is not Found: {}".format(
                      pretrained_model
                  )
              )
      else:
          logger.info(
              "No pretrained model to load, {} will be trained from scratch.".format(
                  model.__class__.__name__
              )
          )
  
imports: import os
  import contextlib
  import tempfile
  import random
  from urllib.parse import urlparse, unquote
  import yaml
  import numpy
  import paddle
  import cv2
  from paddleseg.utils import logger, seg_env, get_sys_env
  from paddleseg.utils.download import download_file_and_uncompress
label_desc: Use image node_id 10 for calling a global function with example usage: load_pretrained_model(model, pretrained_model) without return types