code: def cps_resume(model, optimizer_l, optimizer_r, resume_model):
      if resume_model is not None:
          logger.info("Resume model from {}".format(resume_model))
          if os.path.exists(resume_model):
              resume_model = os.path.normpath(resume_model)
              model_path = os.path.join(resume_model, "model.pdparams")
              para_state_dict = paddle.load(model_path)
  
              opti_l_path = os.path.join(resume_model, "model_l.pdopt")
              opti_l_state_dict = paddle.load(opti_l_path)
  
              opti_r_path = os.path.join(resume_model, "model_r.pdopt")
              opti_r_state_dict = paddle.load(opti_r_path)
  
              model.set_state_dict(para_state_dict)
              optimizer_l.set_state_dict(opti_l_state_dict)
              optimizer_r.set_state_dict(opti_l_state_dict)
  
              epoch = resume_model.split("_")[-1]
              epoch = int(epoch)
              return epoch
          else:
              raise ValueError(
                  "Directory of the model needed to resume is not Found: {}".format(
                      resume_model
                  )
              )
      else:
          logger.info("No model needed to resume.")
  
imports: import os
  import paddle
  from paddleseg.utils import logger
label_desc: Use image node_id 1 for calling a global function with example usage: cps_resume(model, optimizer_l, optimizer_r, resume_model) and returns: epoch