class_docstr: Class to load and save models and their checkpoints during training.
class_docstr_tok: ["Class","to","load","and","save","models","and","their","checkpoints","during","training","."]
docstr: Method to look for the last checkpoint in the model folder
  checkpoint are saved as {model_name}_epoch_{current_epoch}.pt
  
  Args:
      model_folder (str): the folder where the checkpoints are saved
      model_name (str): the name of the model
docstr_tok: ["Method","to","look","for","the","last","checkpoint","in","the","model","folder","checkpoint","are","saved","as","{","model_name","}","_epoch_","{","current_epoch","}",".pt","Args",":","model_folder","(","str",")",":","the","folder","where","the","checkpoints","are","saved","model_name","(","str",")",":","the","name","of","the","model"]
code: def look_for_last_checkpoint(
      model_folder: str,
      model_name: str,
  ) -> Optional[str]:
      """Method to look for the last checkpoint in the model folder
      checkpoint are saved as {model_name}_epoch_{current_epoch}.pt
  
      Args:
          model_folder (str): the folder where the checkpoints are saved
          model_name (str): the name of the model
      """
      # remove .pt to model name
      model_name = model_name.split(".")[0]
      checkpoints = [
          f
          for f in os.listdir(model_folder)
          if f.startswith(model_name)
      ]
      if len(checkpoints) == 0:
          return None
      else:
          checkpoints = sorted(checkpoints)
          # get last checkpoint
          last_checkpoint = checkpoints[-1]
          return last_checkpoint
  
file_path: nebuly/optimization/chatllama/chatllama/rlhf/model_loader.py
imports: import os
  import shutil
  from beartype.typing import Union, Optional, Tuple
  from chatllama.rlhf.config import Config, ConfigActor, ConfigCritic, ConfigReward
  from chatllama.rlhf.model_list import hf_models
label_desc: Use image node_id 3 for calling the ModelLoader obj's underlying member method code with example usage: obj.look_for_last_checkpoint(model_folder, model_name) and returns: None, last_checkpoint