From faf3bf2503035919308565969e9dd6919f49c104 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 21 Feb 2024 20:27:25 -0800 Subject: [PATCH] Perplexity evaluation: make UI events more robust (attempt) --- modules/training.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/training.py b/modules/training.py index 0410ddd1..dd360e7d 100644 --- a/modules/training.py +++ b/modules/training.py @@ -192,11 +192,13 @@ def create_ui(): # doesn't work with the .then() syntax, so I write them one # by one in this ugly but functional way. ev = start_evaluation.click(calculate_perplexity, [models, evaluate_text_file, stride_length, max_length], evaluation_log, show_progress=False) - start_evaluation.click(generate_markdown_table, None, evaluation_table, show_progress=False) + ev.then(generate_markdown_table, None, evaluation_table, show_progress=False) - start_current_evaluation.click(lambda: ['current model'], None, tmp) - ev_cur = start_current_evaluation.click(calculate_perplexity, [tmp, evaluate_text_file, stride_length, max_length], evaluation_log, show_progress=False) - start_current_evaluation.click(generate_markdown_table, None, evaluation_table, show_progress=False) + ev_cur = start_current_evaluation.click( + lambda: ['current model'], None, tmp).then( + calculate_perplexity, [tmp, evaluate_text_file, stride_length, max_length], evaluation_log, show_progress=False) + + ev_cur.then(generate_markdown_table, None, evaluation_table, show_progress=False) stop_evaluation.click(None, None, None, cancels=[ev, ev_cur], queue=False) refresh_table.click(generate_markdown_table, None, evaluation_table, show_progress=True)