code: def load(self, model_file, save_dir, verbose=True):
          
  
          if not os.path.exists(save_dir):
              self.logger.error("Loading failed... Directory does not exist.")
  
          try:
              checkpoint = torch.load(f"{save_dir}/{model_file}")
          except BaseException:
              self.logger.error(
                  f"Loading failed... Cannot load model from {save_dir}/{model_file}"
              )
  
          self.load_state_dict(checkpoint["model"])
          self.settings = checkpoint["config"]
          self.cardinality = checkpoint["cardinality"]
          self.name = checkpoint["name"]
  
          if verbose:
              self.logger.info(
                  f"[{self.name}] Model loaded as {model_file} in {save_dir}"
              )
docs: Load model from file and rebuild the model.
  
          :param model_file: Saved model file name.
          :type model_file: str
          :param save_dir: Saved model directory.
          :type save_dir: str
          :param verbose: Print log or not
          :type verbose: bool