Spaces:
Runtime error
Runtime error
zetavg
commited on
Commit
·
4623b35
1
Parent(s):
517781a
report status while finetune starting
Browse files- llama_lora/ui/finetune_ui.py +15 -6
llama_lora/ui/finetune_ui.py
CHANGED
@@ -269,6 +269,9 @@ def do_train(
|
|
269 |
progress=gr.Progress(track_tqdm=should_training_progress_track_tqdm),
|
270 |
):
|
271 |
try:
|
|
|
|
|
|
|
272 |
clear_cache()
|
273 |
# If model has been used in inference, we need to unload it first.
|
274 |
# Otherwise, we'll get a 'Function MmBackward0 returned an invalid
|
@@ -373,6 +376,9 @@ Train data (first 10):
|
|
373 |
time.sleep(2)
|
374 |
return message
|
375 |
|
|
|
|
|
|
|
376 |
log_history = []
|
377 |
|
378 |
class UiTrainerCallback(TrainerCallback):
|
@@ -436,7 +442,10 @@ Train data (first 10):
|
|
436 |
}
|
437 |
json.dump(info, info_json_file, indent=2)
|
438 |
|
439 |
-
|
|
|
|
|
|
|
440 |
base_model, # base_model
|
441 |
tokenizer, # tokenizer
|
442 |
output_dir, # output_dir
|
@@ -461,7 +470,7 @@ Train data (first 10):
|
|
461 |
logs_str = "\n".join([json.dumps(log)
|
462 |
for log in log_history]) or "None"
|
463 |
|
464 |
-
result_message = f"Training ended:\n{str(
|
465 |
print(result_message)
|
466 |
clear_cache()
|
467 |
return result_message
|
@@ -692,9 +701,9 @@ def finetune_ui():
|
|
692 |
elem_id="finetune_confirm_stop_btn"
|
693 |
)
|
694 |
|
695 |
-
|
696 |
-
"Training
|
697 |
-
label="
|
698 |
elem_id="finetune_training_status")
|
699 |
|
700 |
train_progress = train_btn.click(
|
@@ -710,7 +719,7 @@ def finetune_ui():
|
|
710 |
lora_dropout,
|
711 |
model_name
|
712 |
]),
|
713 |
-
outputs=
|
714 |
)
|
715 |
|
716 |
# controlled by JS, shows the confirm_abort_button
|
|
|
269 |
progress=gr.Progress(track_tqdm=should_training_progress_track_tqdm),
|
270 |
):
|
271 |
try:
|
272 |
+
if not should_training_progress_track_tqdm:
|
273 |
+
progress(0, desc="Preparing train data...")
|
274 |
+
|
275 |
clear_cache()
|
276 |
# If model has been used in inference, we need to unload it first.
|
277 |
# Otherwise, we'll get a 'Function MmBackward0 returned an invalid
|
|
|
376 |
time.sleep(2)
|
377 |
return message
|
378 |
|
379 |
+
if not should_training_progress_track_tqdm:
|
380 |
+
progress(0, desc="Preparing model for training...")
|
381 |
+
|
382 |
log_history = []
|
383 |
|
384 |
class UiTrainerCallback(TrainerCallback):
|
|
|
442 |
}
|
443 |
json.dump(info, info_json_file, indent=2)
|
444 |
|
445 |
+
if not should_training_progress_track_tqdm:
|
446 |
+
progress(0, desc="Train starting...")
|
447 |
+
|
448 |
+
train_output = Global.train_fn(
|
449 |
base_model, # base_model
|
450 |
tokenizer, # tokenizer
|
451 |
output_dir, # output_dir
|
|
|
470 |
logs_str = "\n".join([json.dumps(log)
|
471 |
for log in log_history]) or "None"
|
472 |
|
473 |
+
result_message = f"Training ended:\n{str(train_output)}\n\nLogs:\n{logs_str}"
|
474 |
print(result_message)
|
475 |
clear_cache()
|
476 |
return result_message
|
|
|
701 |
elem_id="finetune_confirm_stop_btn"
|
702 |
)
|
703 |
|
704 |
+
train_output = gr.Text(
|
705 |
+
"Training results will be shown here.",
|
706 |
+
label="Train Output",
|
707 |
elem_id="finetune_training_status")
|
708 |
|
709 |
train_progress = train_btn.click(
|
|
|
719 |
lora_dropout,
|
720 |
model_name
|
721 |
]),
|
722 |
+
outputs=train_output
|
723 |
)
|
724 |
|
725 |
# controlled by JS, shows the confirm_abort_button
|