+ weakest_model = min(models, key=lambda m: float(m.main_test_accuracy))
+
+ log_string(
+ f"training model {weakest_model.id} main_test_accuracy {weakest_model.main_test_accuracy}"
+ )
+
+ one_epoch(weakest_model, quizz_machine)
+
+ log_string(
+ f"train_set_composition w_quizzes {quizz_machine.nb_batch_w_quizzes} c_quizzes {quizz_machine.nb_batch_c_quizzes}"
+ )
+
+ run_tests(weakest_model, quizz_machine, deterministic_synthesis=False)
+
+ log_string(
+ f"test_set_composition w_quizzes {quizz_machine.nb_batch_w_quizzes} c_quizzes {quizz_machine.nb_batch_c_quizzes}"
+ )
+
+ cta = " ".join([f"{float(m.main_test_accuracy):.04f}" for m in models])
+ log_string(f"current_test_accuracies {cta}")
+
+ # Replace a fraction of the w_quizzes with fresh ones
+
+ quizz_machine.renew_w_quizzes(args.nb_train_samples // args.nb_gpts)
+
+ # If all the models are good enough, generate new quizzes and
+ # re-compute the test errors
+
+ if min([m.main_test_accuracy for m in models]) >= args.accuracy_to_make_c_quizzes:
+ create_c_quizzes(
+ models,
+ quizz_machine,
+ nb_for_train=nb_new_c_quizzes_for_train,
+ nb_for_test=nb_new_c_quizzes_for_test,
+ )
+
+ for model in models:
+ run_tests(model, quizz_machine, deterministic_synthesis=False)