Update.
authorFrançois Fleuret <francois@fleuret.org>
Tue, 13 Aug 2024 13:59:11 +0000 (15:59 +0200)
committerFrançois Fleuret <francois@fleuret.org>
Tue, 13 Aug 2024 13:59:11 +0000 (15:59 +0200)
main.py

diff --git a/main.py b/main.py
index 5ef583c..34c0987 100755 (executable)
--- a/main.py
+++ b/main.py
@@ -546,7 +546,7 @@ def model_proba_solutions(m, quizzes):
 
 def record_new_c_quizzes(models, quiz_machine, nb_for_train, nb_for_test):
     nb_validated, nb_to_validate = 0, nb_for_train + nb_for_test
-    nb_to_generate_per_iteration = nb_to_validate
+    nb_generated, nb_to_generate_per_iteration = 0, nb_to_validate
 
     start_time = time.perf_counter()
 
@@ -567,6 +567,8 @@ def record_new_c_quizzes(models, quiz_machine, nb_for_train, nb_for_test):
             procedure=c_quizzes_procedure,
         )
 
+        nb_generated += c_quizzes.size(0)
+
         # We discard the trivial ones, according to a criterion
         # specific to the world quizzes (e.g. B=f(B))
 
@@ -626,7 +628,7 @@ def record_new_c_quizzes(models, quiz_machine, nb_for_train, nb_for_test):
             e = "???"
 
         log_string(
-            f"keep c_quizzes model {model_for_generation.id} validated {nb_validated} / {nb_to_generate_per_iteration} ({100*nb_validated/nb_to_generate_per_iteration:.02f}%) nb_accumulated {nb_validated} / {nb_to_validate} (finishes {e} -- {int((nb_validated * 3600)/duration)}/h)"
+            f"keep c_quizzes model {model_for_generation.id} validated nb_validated {nb_validated} / {nb_to_validate} (finishes {e} -- {int((nb_validated * 3600)/duration)}/h) proportion_kept {nb_validated * 100 / nb_generated:.02f}%"
         )
 
     for s in range(teaching_count.size(0)):
@@ -674,7 +676,7 @@ def record_new_c_quizzes(models, quiz_machine, nb_for_train, nb_for_test):
                     "proba " + " ".join([f"{x.exp().item():.02f}" for x in l])
                 )
 
-            filename = f"culture_c_quiz_{n_epoch:04d}.png"
+            filename = f"culture_c_quiz_{n_epoch:04d}_{model.id:02d}.png"
             quiz_machine.problem.save_quizzes_as_image(
                 args.result_dir, filename, c_quizzes, comments=comments
             )