Kevin Fink commited on
Commit
88673c0
·
1 Parent(s): a520e10
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -243,10 +243,10 @@ def fine_tune_model(model, dataset_name, hub_id, api_key, num_epochs, batch_size
243
  # If the trainer_state.json is missing, look for the previous checkpoint
244
  print(f"Checkpoint {checkpoint_dir} is missing 'trainer_state.json'. Looking for previous checkpoints...")
245
  previous_checkpoints = sorted(glob.glob(os.path.join(os.path.dirname(checkpoint_dir), 'checkpoint-*')), key=os.path.getmtime)
246
-
247
  if previous_checkpoints:
248
  # Load the most recent previous checkpoint
249
- last_checkpoint = previous_checkpoints[-1]
250
  print(f"Loading previous checkpoint: {last_checkpoint}")
251
  train_result = trainer.train(resume_from_checkpoint=last_checkpoint)
252
  else:
 
243
  # If the trainer_state.json is missing, look for the previous checkpoint
244
  print(f"Checkpoint {checkpoint_dir} is missing 'trainer_state.json'. Looking for previous checkpoints...")
245
  previous_checkpoints = sorted(glob.glob(os.path.join(os.path.dirname(checkpoint_dir), 'checkpoint-*')), key=os.path.getmtime)
246
+ print(previous_checkpoints)
247
  if previous_checkpoints:
248
  # Load the most recent previous checkpoint
249
+ last_checkpoint = previous_checkpoints[-2]
250
  print(f"Loading previous checkpoint: {last_checkpoint}")
251
  train_result = trainer.train(resume_from_checkpoint=last_checkpoint)
252
  else: