Kevin Fink
commited on
Commit
·
759ca46
1
Parent(s):
88838d4
dev
Browse files
app.py
CHANGED
@@ -233,10 +233,10 @@ def fine_tune_model(model, dataset_name, hub_id, api_key, num_epochs, batch_size
|
|
233 |
#)
|
234 |
|
235 |
# Fine-tune the model
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
trainer.push_to_hub(commit_message="Training complete!")
|
241 |
except Exception as e:
|
242 |
return f"An error occurred: {str(e)}, TB: {traceback.format_exc()}"
|
|
|
233 |
#)
|
234 |
|
235 |
# Fine-tune the model
|
236 |
+
if os.path.exists(training_args.output_dir) and os.listdir(training_args.output_dir):
|
237 |
+
train_result = trainer.train(resume_from_checkpoint=True)
|
238 |
+
else:
|
239 |
+
train_result = trainer.train()
|
240 |
trainer.push_to_hub(commit_message="Training complete!")
|
241 |
except Exception as e:
|
242 |
return f"An error occurred: {str(e)}, TB: {traceback.format_exc()}"
|