Kevin Fink
commited on
Commit
·
980f253
1
Parent(s):
a479880
dev
Browse files
app.py
CHANGED
@@ -140,11 +140,14 @@ def fine_tune_model(model, dataset_name, hub_id, api_key, num_epochs, batch_size
|
|
140 |
)
|
141 |
|
142 |
# Fine-tune the model
|
143 |
-
|
|
|
|
|
|
|
144 |
trainer.push_to_hub(commit_message="Training complete!")
|
145 |
except Exception as e:
|
146 |
return f"An error occurred: {str(e)}, TB: {traceback.format_exc()}"
|
147 |
-
return 'DONE!'#
|
148 |
'''
|
149 |
# Define Gradio interface
|
150 |
def predict(text):
|
|
|
140 |
)
|
141 |
|
142 |
# Fine-tune the model
|
143 |
+
if os.path.exists(training_args.output_dir) and os.listdir(training_args.output_dir):
|
144 |
+
train_result = trainer.train(resume_from_checkpoint=True)
|
145 |
+
else:
|
146 |
+
train_result = trainer.train()
|
147 |
trainer.push_to_hub(commit_message="Training complete!")
|
148 |
except Exception as e:
|
149 |
return f"An error occurred: {str(e)}, TB: {traceback.format_exc()}"
|
150 |
+
return 'DONE!'#train_result
|
151 |
'''
|
152 |
# Define Gradio interface
|
153 |
def predict(text):
|